Support Article
How to Transition from Alternative to Primary stage in a flow
SA-1768
Summary
After completing all the steps in an alternate stage developer expect to return back to the step of the primary stage that had called the Alternate stage
Given the below scenario the desired behaviour is: When calling AlternateStageA from any step on any stage go back to that step when completed.
StageA StageB StageC StageD
Step1 Step1 Step1 Step1
Step2 Step2 Step2
Step3
AlternateStageA
Step1
Step2
For example being on StageA-Step2 calling and completing AlternateStageA(Step1 and Step2) process should go back to StageA-Step2.
What usually happens is that when completing AlternateStageA, rather StageB is being called. When checking the History we can see entries like this “Automatically transition from StageA to StageB”. Developer wants to return baack to StageA-Step2 after completing Alternative stages avoiding automatic transition.
Additional note: When using the workaround "pxIsInCurrentStage" when rule on the stage’s step this is skipped always after the alternate stage is being completed and if the when rule is placed in all the steps all of them are being skipped.
Resolution
The explanation for this behaviour is as follows:
1. Automatic transition cannot be done to and from an alternate stage; Developer will have to use controlled transition to jump to and from an alternate stage
2. Developer can go back to any of the stages, an issue being automatically pushed to Stage-B even if specified transition to go to Stage-A on an alternate stage.
To overcome this problem, developer can open Step1 of Stage-A using ‘Configure Stage Behaviour” and then select “Launch on re-entry option’ as per attached screen snap(below).
3. Also note that upon going back to any Stage will always go to the first Step unless specified Step2 of that stage to ‘Start Step upon stage Entry’. Even though Pega doesn’t have a direct mechanism to go back to the specific step where the transition was made, Developer can setup automatic transition to go to specific stage but it will start the step in sequential order. “Launch on re-entry’ option provides flexibility to achieve the desired configuration/behaviour.
To go to exact step of that stage When rules can be used to control which steps are executed in a stage, and that would be the way to go to a particular step upon re-entry. When rule control is available for each step, whether parallel or sequential. Since a When rule can be parameterized, Developers will have an opportunity to use one When rule to control many steps. (e.g. When the property .StepIWasOnBefore > param.ThisStepNumber, skip the step).
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.