On the custom entity I have business process flow and plugin on an update.
I would like to obtain actual StageName. I have written code which is getting me only previous StagName.
E.g. I have phase 1,2,3,4. I am in phase 1 and click on button "next phase" this code can not identify that
I am in phase 2, but show me again phase 1.
Is there any solution how to identify previous and actual phase name on plugin? Below you can find my code.
string actualstagename = "";
RetrieveProcessInstancesRequest retrieveProcessInstancesRequest = new RetrieveProcessInstancesRequest
{
EntityId = EntityGuid,
EntityLogicalName = "new_customentity"
};
RetrieveProcessInstancesResponse retrieveProcessInstancesResponse =
(RetrieveProcessInstancesResponse)service.Execute(retrieveProcessInstancesRequest);
Guid activeProcessInstaceId = new Guid(retrieveProcessInstancesResponse.Processes.Entities[0].Id.ToString());
EntityReference workflowReference =
(EntityReference)retrieveProcessInstancesResponse.Processes.Entities[0].Attributes["processid"];
Entity curenttestprocesss = service.Retrieve("new_bpf_" + workflowReference.Id.ToString().Replace("-", ""), activeProcessInstaceId, new ColumnSet(true));
RetrieveActivePathRequest retrieveActivePathRequest = new RetrieveActivePathRequest
{
ProcessInstanceId = activeProcessInstaceId
};
RetrieveActivePathResponse retrieveActivePathResponse =
(RetrieveActivePathResponse)service.Execute(retrieveActivePathRequest);
foreach (var processStage in retrieveActivePathResponse.ProcessStages.Entities)
{
TracingService.Trace("T9 " + ((EntityReference)curenttestprocesss["activestageid"]).Id.ToString());
TracingService.Trace("T10 "+ processStage["processstageid"].ToString());
if (((EntityReference)curenttestprocesss["activestageid"]).Id.ToString() == processStage["processstageid"].ToString())
{
actualstagename = processStage["stagename"].ToString();
}
}
TracingService.Trace("StageName: " + actualstagename);
*This post is locked for comments