Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 2015年Dynamics CRM中的业务流程消失_C#_Dynamics Crm 2015 - Fatal编程技术网

C# 2015年Dynamics CRM中的业务流程消失

C# 2015年Dynamics CRM中的业务流程消失,c#,dynamics-crm-2015,C#,Dynamics Crm 2015,我有BPF案例实体(基于默认的“电话到案例流程”)。 当我通过C#代码解决或取消案例时,BPF会从特定案例表单中消失,这会导致表单中出现JS错误。 当我从CRM解决或取消案例时,BPF正常显示 我的解决案例代码: Entity incidentResolution = new Entity("incidentresolution"); incidentResolution.Attributes["incidentid"] = new EntityReference("in

我有BPF案例实体(基于默认的“电话到案例流程”)。 当我通过C#代码解决或取消案例时,BPF会从特定案例表单中消失,这会导致表单中出现JS错误。 当我从CRM解决或取消案例时,BPF正常显示

我的解决案例代码:

      Entity incidentResolution = new Entity("incidentresolution");
      incidentResolution.Attributes["incidentid"] = new EntityReference("incident", caseID);
      if (!string.IsNullOrEmpty(resolution))
      {
        incidentResolution.Attributes["subject"] = resolution;
      }
      if (!string.IsNullOrEmpty(description))
      {
        incidentResolution.Attributes["description"] = description;
      }

      CloseIncidentRequest closeIncidentRequest = new CloseIncidentRequest
      {
        IncidentResolution = incidentResolution,
        Status = new OptionSetValue(1000)
      };

      crmService.Execute(closeIncidentRequest);
这是我取消案例的代码:

      SetStateRequest setState = new SetStateRequest();
      setState.EntityMoniker = new EntityReference();
      setState.EntityMoniker.Id = caseID;
      setState.EntityMoniker.LogicalName = "incident";
      setState.State = new OptionSetValue(2);
      setState.Status = new OptionSetValue(2000);

      crmService.Execute(setState);

在这种情况下,我可以为BPF做些什么吗?

业务流程流
(BPF)
通过两个字段针对CRM实体进行管理
processid
stageid
。您必须找到适当的阶段id和流程id,它们由CRM放在案例记录中

从crm中查找阶段id和流程id解决或取消案例,并在数据库中查询这两个字段

因此,在取消/解决案例之前,您必须更新案例

Entity caseEntity = new Entity("incident");
caseEntity.Id=caseID
caseEntity["processid"]= new Guid("ABC") //the processid from DB
caseEntity["stageid"]=new Guid("DEF") //the stageid from DB
crmService.Update(caseEntity);