了解 CRM 中的审计 table
Making sense of the Audit table in CRM
我正在尝试从 CRM 中提取所有合并记录,我在联系人记录的“审计历史”页面中看到以下内容:
如果我点击它,我会得到以下信息:
如果我分析代码以查看 SQL 运行的内容,它会执行以下操作:
exec sp_executesql N'select
"audit0".AuditId as "auditid"
, "audit0".AttributeMask as "attributemask"
, "audit0".ChangeData as "changedata"
, "audit0".CreatedOn as "createdon"
, "audit0".Action as "action"
, "audit0".Operation as "operation"
, "audit0".CallingUserId as "callinguserid"
, "audit0".UserId as "userid"
, "audit0".ObjectId as "objectid"
, "audit0".ObjectTypeCode as "objecttypecode"
, "audit0".CallingUserIdName as "callinguseridname"
, "audit0".UserIdName as "useridname"
, "audit0".ObjectIdName as "objectidname"
from
Audit as "audit0"
where
("audit0".AuditId = @AuditId0)',N'@AuditId0 uniqueidentifier',
@AuditId0='7FE1B120-87EC-E811-8BE0-005056B12EA2'
结果显示为:
有谁知道我是怎么得到实际合并的Yes记录的?我无法理解它们如何显示为旧值 v 新值的结果。
当您在 CRM 中的记录上单击 保存 按钮时,会在 SQL 中创建 一个 审计行,它描述此保存所做的所有更改。只有 old values
存储在 SQL.
那么如何获得new values
?
您可以按 createdon 升序对 audit 查询进行排序,对于每一行,new value
是下一行 old value
。要获得最终的 new value
,您应该加入 audit table 与 contact table 并获得 Merged 字段值来自 contact table.
我正在尝试从 CRM 中提取所有合并记录,我在联系人记录的“审计历史”页面中看到以下内容:
如果我点击它,我会得到以下信息:
如果我分析代码以查看 SQL 运行的内容,它会执行以下操作:
exec sp_executesql N'select
"audit0".AuditId as "auditid"
, "audit0".AttributeMask as "attributemask"
, "audit0".ChangeData as "changedata"
, "audit0".CreatedOn as "createdon"
, "audit0".Action as "action"
, "audit0".Operation as "operation"
, "audit0".CallingUserId as "callinguserid"
, "audit0".UserId as "userid"
, "audit0".ObjectId as "objectid"
, "audit0".ObjectTypeCode as "objecttypecode"
, "audit0".CallingUserIdName as "callinguseridname"
, "audit0".UserIdName as "useridname"
, "audit0".ObjectIdName as "objectidname"
from
Audit as "audit0"
where
("audit0".AuditId = @AuditId0)',N'@AuditId0 uniqueidentifier',
@AuditId0='7FE1B120-87EC-E811-8BE0-005056B12EA2'
结果显示为:
有谁知道我是怎么得到实际合并的Yes记录的?我无法理解它们如何显示为旧值 v 新值的结果。
当您在 CRM 中的记录上单击 保存 按钮时,会在 SQL 中创建 一个 审计行,它描述此保存所做的所有更改。只有 old values
存储在 SQL.
那么如何获得new values
?
您可以按 createdon 升序对 audit 查询进行排序,对于每一行,new value
是下一行 old value
。要获得最终的 new value
,您应该加入 audit table 与 contact table 并获得 Merged 字段值来自 contact table.