I am struggeling with an edge case i guess.
I wrote a plugin that determines the active processstage of an opportunity. It reads the active process from the "userentityuisettings" table and than gets the processstage from all active BPF revieved by using "RetrieveProcessInstancesRequest". So it work even if i got multiple active processes on an opportunity and switch from one to another in the frontend.
If i delete a processstage in the bpf editor which still holds opportunities, the frontend falls back to the first processstage in the process but it seems that it is not realy activting the first processtage. I want to fallback in c# too but the opportunity itself respectively its businessprocessflowinstance will still show the delted processstage-guid in "processstageid". So i cannot use that. "traversedpath" is an emtpy string and RetrieveActivePathResponse will return an empty collection so i cannot use that too. It seems the only possible way to get the first stage which is shown in the frontend would be to get all processtages of the bpf itself in the order of the process and then grab the first item. But i dont know how to do that. How to achieve that without using "RetrieveActivePathResponse" of a businessprocessflowinstance?
Where is the order information even stored? Or is there a way to retrieve the defaultPath from the BPF not the instance?
EDIT: It seems that the process information itself is located in the workflow table. Column "xaml". How to parse the XAML of a business process flow?
The documentation for the loader shows an example with type <int> but i guess it has to be something workflow specific in this case?
DynamicActivity wf = ActivityXamlServices.Load(new StringReader(serializedAB)) as DynamicActivity;
docs.microsoft.com/.../serializing-workflows-and-activities-to-and-from-xaml