我在案例实体中有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做些什么吗?
答案 0 :(得分:0)
业务流程(BPF)
由两个字段针对 CRM实体进行管理
processid
和stageid
。您必须找到适当的阶段ID和processid ,它们由CRM放置在案例记录中。
要查找阶段ID和processid ,请从crm中解析或取消案例,并在数据库中查询这两个字段。
所以在Cancelling/Resolving Case
之前你必须更新案例。
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);