究竟是什么" EntityMoniker"在Dynamics CRM中以及何时使用它。是否使用而不是" Target"实体?
答案 0 :(得分:4)
“EntityMoniker”是SetStateRequest类的属性,它的类型为EntityReference。虽然“Target”是AssignRequest,CreateRequest,DeleteRequest,ExecuteWorkflowRequest,MergeRequest和UpdateRequest类的属性,但它的类型为Entity。
答案 1 :(得分:2)
EntityMoniker
用于SetStateRequest。我有以下方法,用于更改Status
CRM 2011/2013
public static void SetStatus(string EntityName, Guid Id, int StateCode, int StatusCode)
{
try
{
if (Service == null)
throw GRID.CRM.ExceptionHandler.ExceptionUtil.GetException("Connection with CRM is Lost", typeof(Common), "SetStatus");
SetStateRequest StateRequest = new SetStateRequest();
StateRequest.EntityMoniker = new EntityReference(EntityName, Id);
StateRequest.State = new OptionSetValue(StateCode);
StateRequest.Status = new OptionSetValue(StatusCode);
SetStateResponse StateResponse = (SetStateResponse)Service.Execute(StateRequest);
}
catch (Exception ex)
{
throw GRID.CRM.ExceptionHandler.ExceptionUtil.GetException(ex, typeof(Common), "SetStatus");
}
}