微软 Power Apps model drven app 模型驱动应用使用Plugin插件实现业务流程跳转阶段功能
模型驱动应用使用插件实现跳转业务流程阶段跳转功能
在实际操作中总会遇到使用业务流程的需求,那么如何使用plugin实现跳转阶段的功能呢
需求背景是主表上有业务流程,子表上有一个选项集字段,选项集字段包含所有的业务流程阶段,在更新子表的选项集时主表的业务流程阶段也需要同步跳转。
由于创建和更新查询不同,所以可以写两个plugin 也可以写在一个中使用message去控制
//创建时执行
if (Context.MessageName=="Create")
{
//查询刚刚触发创建的业务流程(业务流程实体)
string strXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>";
strXml += "<entity name='new_start'>";
strXml += "<attribute name='businessprocessflowinstanceid' />";
strXml += "<attribute name='bpf_name' />";
strXml += "<attribute name='createdon' />";
strXml += "<attribute name='bpf_new_salesopportunityid' />";
strXml += "<attribute name='activestageid' />";
strXml += "<attribute name='statecode' />";
strXml += "<attribute name='statuscode' />";
strXml += "<attribute name='createdby' />";
strXml += "<attribute name='processid' />";
strXml += "<order attribute='bpf_name' descending='false' />";
strXml += "<filter type='and'>";
strXml += "<condition attribute='businessprocessflowinstanceid' operator='eq' value='" + target.Id + "' />";
strXml += "</filter>";
strXml += "</entity>";
strXml += "</fetch>";
EntityCollection start = Service.RetrieveMultiple(new FetchExpression(strXml));
if (start.Entities.Count > 0)
{
Entity Entityta