crm2011查询审核记录
来源:互联网 发布:飞鸽翻墙软件 编辑:程序博客网 时间:2024/06/10 17:54
using System;
using Microsoft.Xrm.Sdk;
using Microsoft.Crm.Sdk.Messages;
/// <summary>
/// 查询审核记录
/// </summary>
public class RetrieveRecordChangeHistoryRequestHelper
{
public void Retrieve(IOrganizationService service,string entityName,Guid id)
{
RetrieveRecordChangeHistoryRequest changeRequest = new RetrieveRecordChangeHistoryRequest();
changeRequest.Target = new EntityReference() { LogicalName = entityName,Id = id };
RetrieveRecordChangeHistoryResponse changeResponse = (RetrieveRecordChangeHistoryResponse)service.Execute(changeRequest);
AuditDetailCollection details = changeResponse.AuditDetailCollection;
if (details != null && details.AuditDetails.Count > 0)
{
foreach (AuditDetail detail in details.AuditDetails)
{
System.Console.WriteLine(detail.GetType());
DisplayEntity(detail.AuditRecord, "AuditRecord");
if (detail.GetType() == typeof(AttributeAuditDetail))
{
AttributeAuditDetail attrDetail = (AttributeAuditDetail)detail;
foreach (string item in attrDetail.InvalidNewValueAttributes)
{
System.Console.WriteLine(item);
}
DisplayEntity(attrDetail.NewValue, "NewValue");
DisplayEntity(attrDetail.OldValue, "OldValue");
}
if (detail.GetType() == typeof(RelationshipAuditDetail))
{
RelationshipAuditDetail shipDetail = (RelationshipAuditDetail)detail;
System.Console.WriteLine("RelationshipName" + shipDetail.RelationshipName);
if (shipDetail.TargetRecords != null && shipDetail.TargetRecords.Count > 0)
{
foreach(EntityReference item in shipDetail.TargetRecords)
{
System.Console.WriteLine("LogicalName: " + item.LogicalName + ",Name: " + item.Name);
}
}
}
}
}
}
public void DisplayEntity(Entity entity,string label)
{
System.Console.WriteLine("display" + label + "start!");
var keyArray = entity.Attributes.Keys;
foreach (string name in keyArray)
{
System.Console.WriteLine("attributeName: " + name + ",attributeValue: " + entity.Attributes[name]);
}
System.Console.WriteLine("display" + label + "end!");
}
}
- crm2011查询审核记录
- crm2011 使用SOAP 查询单个记录 Retrieve
- crm2011开启组织审核
- crm2011开启实体审核
- crm2011停用启用记录
- crm2011启用或者禁用实体审核
- crm2011 分配记录给用户
- crm2011 停用和启用记录
- crm2011查询公共选择框
- MySQL--根据审核时间排序,查询最后一次审核的物品采购记录
- crm2011 更改数据库导出excel记录限制
- CRM2011取消共享后还能看到记录
- CRM2011 将Query查询转化为FetchXml
- crm2011 将FetchXml查询转化为Query
- crm2011查询表的关联关系
- crm2013开启审核和查看审核记录信息
- windows共享文件删除记录审核
- 记录下苹果审核被拒原因
- Win32编程点滴之PreTranslateMessage与消息循环
- 理解文档/视图结构
- 便携式斑马打印机条码控件ThermalLabel SDK
- 查看一个变量的类型
- Mac OS X 10.9 安装 rails
- crm2011查询审核记录
- 主语从句
- 免费安全软件
- 最小生成树算法 prim算法
- POJ1862_Network(最小生成树)
- 员工管理系统
- android全屏设置
- 【机器学习】HMM算法
- C++中的引用和const