I'm attempting to add a link/button to a flow action that would allow the user to return to a previously visited stage. I've reviewed this article (Everything about Stages Runtime Implementation) and it appears that this should be possible. However, the activity executes, but the flow is not actually moved back to the prior stage. Using the local flow action, pyChangeStage, works, but a single button click is preferred rather than having to go through the steps to select the target stage, etc.
I've also tried calling the pzPreChangeStage activity in my flow action's pre-action, and pyChangeStage from the button. This doesn't work either.
Any input or suggestions would be appreciated.
***Updated by moderator: Lochan to close post*** This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
Hi Kip. And welcome to the Pega Support Community!
pxChangeStage is what is called an "engine API". That means it is not, in and of itself, a full transaction. Your link/button requires one. It needs to lock the work object first if the start is on a Review harness, and either way it needs to call RecalculateAndSave and then Commit at the end.
Thanks for your input... I've adjusted my flow as follows:
I call resumeFlow from my link with "backToCustInfo" as the flow action param. This "almost" works. The flow is changed, and the assignment goes back to the one from the previous stage. However, when the perform harness repaints, there nothing below the stage display, as shown below.
After the resumeFlow, I'm doing a Refresh Harness. If I close and reopen the case, it's exactly where I want it to be and the perform harness renders correctly.
Refresh harness won't work because you resolved the assignment you'd been on. If you close and reopen the case, it reopens onto the Review harness, and then when you pick the right assignment from Case Contents, the Perform harness renders correctly.
If you want back-to-back processing where you click the change stage link and then go from one assignment's perform harness to another's, you might be able to use the FinishAssignment event in conjunction with your backToCustInfo flow action to achieve this, but I'm not sure.
Late following up on this, I know, but I was able to make this work finally. After executing the change stage, I grabbed the key of the current work object from the clipboard and then called a custom version of GetNextWork, restricting the results to the work object key I just saved. This grabs the new assignment and opens the object in perform mode and actually is very clean, seamless transition.
This is a great thread, what if I want to change to a previous stage and go to a specific assignment in that stage - not start at the top? Is the best solution to set a param or property as part of the change stage smart shape and then evaluate for the presence of that in the stage I am returning to? Or, set a ticket? If there are multiple flows in the stage, and we need to get to a specific assignment in say flow number two of that stage, what is the best approach?
For choosing which Flows to execute, try using When rules. At run-time you will set one or more Properties such that the When rules controlling each Flow will be true or false as needed. Getting to a particular Assignment, if not the first, is a matter of traditional Flow engineering, but you're probably better off to break up your sequencing into enough separate Flows so that each "re-entry point" is the start of a Flow. You can also turn off the launch upon re-entry flag (only for Flows at the head of a sequnce) if you know that you will never want to rerun that Flow (and its successors) upon re-entry to the stage.
I need to accomplish this but from a pull rather than a push perspective. Similar to what we can do with our time sheets or expense reports. I submit it forward realizing I made a mistake. I can pull it back to myself and to the previous stage in the case flow. I can't fine an activity to accomplish this. I've used the pyChangeStage activity but it doesn't work correctly. Any thoughts?