CRM 2015在线,业务流程,插件错误

时间:2015-04-14 02:43:40

标签: plugins dynamics-crm-2015 business-process

专家。 我在自定义实体中有自定义BPF。有一个插件由另一个实体触发来更新这个具有BPF的自定义实体。我现在遇到的问题是如果自定义实体(使用BPF)BPF阶段不是第一阶段,插件将因此错误而失败:

遍历的路径应以新的活动阶段结束。

如果自定义实体(带BPF)BPF阶段处于第一阶段,则插件运行良好。该插件只是更新自定义实体的某些字段(使用BPF)。

你们能告诉我一些建议吗?我真的不明白这个错误,我试着去谷歌,但我找不到什么信息。 感谢。

2 个答案:

答案 0 :(得分:2)

if you get travesed path error their is an field in entity called

travesedpath

so this field contain stages id from 1st to current active stage eg if your entity has a process flow and it has 6 stages and current active stage is 3rd stage. so travesedpath contain 3 Guid from 1st stage to 3rd stage like c1a07479-aa88-4b50-9675-61d840083530,efff5adb-48f2-47c7-8d0b-5f3807702f9b,a2717242-a072-4cd0-ac57-3a4eaddbcca7with comma separated this travesedpath field is text field in plugin you will first get traversedpath from current entity or preimage then add new guid with this travesed path. eg. string traversedPath = currentEntity.Attribute["traversedpath"]; thentravesedPath += newStageid;` then update your entity

答案 1 :(得分:0)

这里的问题是BPF需要一个列表,列出在用于分支时创建的所有guid。这意味着您需要执行以下操作:

string straversed = entity["traversedpath"].ToString();
string stageid = entity.Attributes["stageid"].ToString();   
entity.Attributes["traversedpath"] = straversed + "," + stageid;

try
{
 service.Update(entity);
}

当前阶段是遍历路径中的最后一个guid,因此您将stageid添加到遍历路径。

这应该有效!如果有,请告诉我!

相关问题