有人可以解释一下" EntityMoniker"什么时候在Dynamics CRM中使用它?

时间:2014-12-19 17:27:43

标签: dynamics-crm-2011 dynamics-crm-2013

究竟是什么" EntityMoniker"在Dynamics CRM中以及何时使用它。是否使用而不是" Target"实体?

2 个答案:

答案 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");
        }
    }