Support Article
Sequential processing of actions in an action set not working
Summary
Actions in an action set are not processed sequentially. A When rule on a second action in the action set is evaluated before the first action is completed.
Error Messages
Not Applicable
Steps to Reproduce
- Create an action set with two actions on a button. The first action refreshes the screen. The second action launches a local action only if there are no errors on the screen (based on the When condition configured). The actions must be processed sequentially.
- Launch the UI.
- Enter incorrect data in the section.
- Press the button.
Root Cause
According to the Implementation of Sequential Actions and the When rule evaluation associated with them, each of the When rule is evaluated at the server during the start of the action sequence.
The When rule is not evaluated at runtime in the middle of the actions. Thus, when three actions are configured and if the last action has a When condition, the When condition must be evaluated before the first action starts. That is, when the button is clicked, the page messages must be present and the When rule must be evaluated to false.
At the Markup level, the button is regenerated with a markup, with or without the third action (Local Action) based on the When condition at the beginning.
Resolution
- Configure the Button Action set as below,
a. Navigate to Cell Properties.
b. Open the settings for 'Action set 1'.
c. Set the Function Name as clearactoinqueue in the Run Script option.
Remove the When Condition for the local action.
- In the UserWorkForm HTML fragment rule, add the below code.
<script>
function clearactionqueue(){
var node=document.querySelector("div[node_name='pyCaseErrorSection']");
if(node&&node.offsetHeight >0){
pega.control.actionSequencer.clearQueue();
}
}
</script>
Note: The pyCaseErrorSection (section name) is the Pega out-of-the-box error handling section. If a different section is used, include that name.
The section renders as below:
3. Save all the rules.
Published August 19, 2019 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.