如何使用FetchXML获取审核记录详细信息 [英] How to get audit record details using FetchXML

查看:111
本文介绍了如何使用FetchXML获取审核记录详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用该查询无法在线检索Microsoft Dynamics CRM中的审核记录

Using this query im able to retrieve audit records in Microsoft Dynamics CRM online

<fetch version="1.0" >
  <entity name="audit" >
    <all-attributes/>
  </entity>
</fetch>

但这缺少有关操作中发生的情况的信息,更具体地说是列的旧值新值已更改。当我在常规界面的设置中使用审核工具时,将显示此数据,因此该数据存在。有人知道如何获取吗?

But this lacks the info about what happened in the operation, more specificly the old value and new value of the column changed. This data is shown when i use the audit tool in the settings of the regular interface, so the data is present. Does anyone know how to fetch it? Is there another entity im missing?

推荐答案

审计记录仅跟踪旧值。因此,修改属性后,只有其旧值存储在审计表中。

Audit records only keep track of the old values. So, when an attribute is modified, only its old value is stored in the audit table.

必须通过从活动实体记录中获取新值或从新值中获取新值(当值被多次修改时),获取该实体后续审核记录的旧值。旧值可以在 Audit 实体的 ChangeData 字段中找到。

A new value must be derived by either getting it from the live entity record or (when the value was modified multiple times) by getting the old value of a succeeding audit record for that entity. The old value can be found in the ChangeData field of the Audit entity.

直接使用Audit实体重建实体历史将需要大量工作,并且在大多数情况下是不必要的。相反,您可以使用 RetrieveRecordChangeHistoryRequest 。相应的 RetrieveRecordChangeHistoryResponse 具有 AuditDetail 集合。集合中类型为 AttributeAuditDetail 的项目包含 OldValue NewValue 可为您提供所需信息的属性。

Reconstructing the entity history using the Audit entity directly will require a lot of work and is in most scenarios not necessary. Instead you can use the RetrieveRecordChangeHistoryRequest. The corresponding RetrieveRecordChangeHistoryResponse has an AuditDetail collection. Items in the collection that are of type AttributeAuditDetail contain OldValue and NewValue properties giving you the information you need.

这篇关于如何使用FetchXML获取审核记录详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆