What's the best way to get the flow name when resume a flow?
Assume there is a work object which has been processed and in pending status (not completed yet). Now we need to use the activity ResumeFlow to continue the path. If don't know the flow name at the point, what's the best way to find out the flow name? Currently, I am using the pxStageHistory in pyWorkpage after open this work object. It contains a list of history steps for the WO. And the last page in pxStageHistory is the latest step that the WO is in. I can see the pxSubscript in pxProcesses(1) is the flow name to use. I wonder if this is the best approach and how reliable it is.
Thanks for your advice and comments in advance!
***Updated by Moderator: Marissa to update categories***
Inorder to get the open assignments of a work object, you can look over the pxFlow page group under pyWorkPage and in that you can look for the required flow of your existing case. The first entry in the page group will be usually some pega pre-defined flow like pzInternalStageFlow. Please find the below attachments.
I believe pzInternalStageFlow lasts through out the case life cycle. But I observed .pxRouteTo property holds the operator to whom the corresponding assignment or flow (subscript of pxFlow()) is assigned. So, while looping through pxFlow Page group, when logged in operator is same as pxRouteTo (OperatorID.pyUserIdentifier == .pxRouteTo), then we can consider the active flow is the subscript of current pxFlow iteration.
Loop over all the pxFlow on work page with pre condition to skip those pxFlow where pxIsSystemFlow is set to true. This property will be set to true for all internal flows. First flow that you find which is not system flow can be taken as the flow name. This is very reliable approach.
Only caveat is you should not have parallel flows running on work page.
When you have called a subflow how can you find the current flow name? In my example I'm two levels deep in subflows. My main flow has called a subflow and that subflow has called another subflow. The last subflow parks in an assignment and I have to save off some data including the flow name so that an agent can resume from the assignment. I can hardcode the flow name but that is not future proof.