简体   繁体   English

Dynamics CRM 2013:审核日志具有“空白”记录

[英]Dynamics CRM 2013: Audit logs have “blank” records

On a custom entity I enabled a single field for auditing which seems to be working fine. 在一个自定义实体上,我启用了一个字段进行审核,这似乎运行良好。 But there are many, many more audit records having changed date, changed by (both user and service accounts) and event of Update but blank changed field, old value and new value columns. 但是,有许多审核记录已更改日期,更改了(用户帐户和服务帐户)以及更新事件,但空白字段,旧值和新值列已更改。 Opening one of these "blank" records shows the message given in the title. 打开这些“空白”记录之一将显示标题中给出的消息。 记录中的示例

And when you open one of them what you see is no table but the statement "the fields changed by this action are not enabled for audit tracking". 并且,当您打开其中一个时,您看到的是没有表,但语句“此操作更改的字段未启用审核跟踪”。

Yeah, I know. 是的,我知道。 All but one of the fields is not enabled for audit tracking. 除一个字段外,所有字段均未启用审核跟踪。 Clearly these are events generated by a plugin or workflow. 显然,这些是由插件或工作流生成的事件。

Why is it giving me these and how do I make it stop? 为什么给我这些东西,我如何停止呢?

Why is it giving me these 为什么给我这些

Because the fields are being updated. 因为这些字段正在更新。 As you mention this is likely by a plugin or a workflow. 如您所述,这很可能是由插件或工作流程引起的。

Plugins often update fields by mistake when they forget to instantiate a new Entity and give it only the necessary attributes to update: 插件在忘记实例化新Entity并仅赋予其必要属性以进行更新时,常常会错误地更新字段:

Instantiating a new entity 实例化一个新实体

var smallEntity = new Entity { Id = new Guid("entityId"), LogicalName = "entityName" };
smallEntity["firstname"] = "newName";
...
service.Update(smallEntity);

Updating all fields unnecessarily 不必要地更新所有字段

var bigEntity = service.Retrieve(new Guid("entityId"), "entityName", new ColumnSet(true));
bigEntity["firstname"] = "newName";
...
service.Update(bigEntity);

smallEntity contains only one attribute. smallEntity仅包含一个属性。 When Update is called, audit history will show only one field as having updated. 调用Update ,审核历史记录将仅显示一个字段为已更新。

bigEntity contains every single entity attribute because it was retrieved using new ColumnSet(true) . bigEntity包含每个单独的实体属性,因为它是使用new ColumnSet(true)检索的。 When Update is called, audit history will show all fields as having updated, even though only "firstname" has actually changed. 调用Update ,即使实际上只有"firstname"已更改,审核历史记录也会将所有字段显示为已更新。

how do I make it stop? 我如何使其停止?

One option would be to filter the audit history view to only show the field you're interested in: 一种选择是过滤审核历史记录视图以仅显示您感兴趣的字段:

在此处输入图片说明

Audits can be enabled in 3 levels namely Organization, Entity & Attribute level. 可以在三个级别启用审核,即组织,实体和属性级别。

System will start collecting the attribute values which are all audit enabled, for capturing the old value & new value (not current value). 系统将开始收集所有已启用审计的属性值,以捕获旧值和新值(不是当前值)。

Your explicit updates in plugin/workflow initiated audit on entity but the attributes updated on such service updates were not eligible (may be unchanged values) for value capturing. 您在插件/工作流程中的显式更新启动了对实体的审核,但是在此类服务更新上更新的属性不符合(可能是不变的值)进行价值捕获的条件。

If you see the audit table in database also, the row will be empty with ~ and , (without column names & stored old/new values) 如果您还在数据库中看到审计表,则该行将为空,带有〜和(没有列名和存储的旧/新值)

You cannot stop collecting this, but can find out the fields by enabling audit on all fields & identify the plugin steps. 您不能停止收集这些内容,但是可以通过对所有字段启用审核并确定插件步骤来查找字段。 Then initiate the entity object like Dave mentioned & avoid this. 然后启动像Dave提到的实体对象并避免这种情况。

Update : Am 100% right. 更新 :是100%正确。 This happened for me when I associate a lookup (which is not audit enabled) 当我关联查询(未启用审核)时,这发生在我身上

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM