Close popover
Kensho Tsuchihashi (KenshoTsuchihashi)
Project Delivery Leader
Pegasystems Inc.
KenshoTsuchihashi Member since 2010 132 posts
Posted: 1 week 6 days ago
Last activity: 1 week 5 days ago

How to get condition on action to work


I've heard quite a few people say condition on action doesn't work sometimes (shown below). If you observe that issue, that may come from the same reason. In this post, I am sharing why that problem occurs, and how to resolve it.

Condition on action


  • Working scenario

Let me start with a working scenario. Place an "Item" property on screen. If user enters "CPU" and clicks "Check inventory and submit" button, system pops up a modal dialog saying "CPU is out of stock". If user enters some other Strings and does the same, the assignment gets submitted without popping up a modal dialog.

(1) If user enters "CPU" and clicks "Check inventory and submit"..

Data entry "CPU" on screen

(2) System pops up a modal dialog as below.

CPU is out of stock

(3) Instead, if user enters some other Strings and clicks "Check inventory and submit"..


(4) The assignment is finished and the case is routed to the next step.

Confirm Harness


Add two actions for the button click event - "Local action" and "Finish Assignment". Configure conditions for each action accordingly so that local action is run when Item is "CPU", while finish assignment is run when Item is not "CPU".

Button configuration


  • Not working scenario

Now, here is when things don't work as expected. Instead of having "Item" property on UI, remove it and set it by an activity. In a real world, this could be REST API to get inventory status from external system, but in this sample I am hardcoding it for the sake of simplicity.

(1) Remove an "Item" property from screen.

No Item property

(2) Add "Refresh this section" action and fire an activity to populate "CPU" to Item property. This action has to be placed prior to both of two actions.

Refresh this section with an activity

(3) You may expect the modal dialog to pop up just like the 1st scenario, but it does not work the same way. The assignment is completed and the case is routed to the next step. Note the "CPU" is loaded on the clipboard correctly.

Confirm Harness not expected


  • Root cause

Why these two scenarios behave differently? It is because "data-changed" meta data on the control can get updated only if the DOM (Document Object Model) is refreshed, and cannot get updated correctly in the middle of the execution of an action set. "data-changed" meta data can be observed if you turn on Developer tool as below.

data-changed meta data

  • Solution

Place the "Item" property on screen so that it is available in DOM at run time. This way, when the 1st action (Refresh this section) is performed and property is changed by activity, DOM gets re-generated and hence condition can work properly.

Also, most of the times the property shouldn't be visible for users. In that case, you can use "Hidden text" control shown below so the property won't take up unnecessary extra space.

Hidden text





***Edited by Moderator Marissa to update Platform Capability tags****
Pega Platform 8.4.1 Case Management User Experience Developer Knowledge Share