Pre- and post-processing in Flow Actions
Sometimes you need to perform a set-up or wrap-up action in conjunction with a flow action. For example, you may need to initialize items in a list or copy data from one property to another. To satisfy these needs, you can add pre-processing and post-processing actions to a flow action. The following image shows that pre-processing begins before and post-processing begins after the assignment runs.
Caution: Verify that adding an action to the flow action is the best way to perform the action. For example, when configuring the concatenation of a user's first and last names, consider using a declare expression. With a declare expression, the concatenation is performed only when necessary. With a pre- or post-processing on the flow action, the concatenation is performed every time. In most cases, you can use connectors and data pages instead of a pre-processing action. In some cases, you can configure an optional action in App Studio instead of a post-processing action.
Pre-processing action use case
Consider a trip case type example. TGB hosts an annual meeting for employees and vendors. TGB employees use the trip case type to finalize travel arrangements for all business trips. Approximately 60 percent of the processed trip cases are for the annual company meeting. TGB's application requirements include creating a default event for the annual company meeting. Default values populate the event form at rendering. If the user removes the default event, the event values do not populate again. The case type must also be suitable for all company travel requests.
You can use a data transform to populate the annual company meeting on the event form as a pre-processing action. The first time a user opens the form, the data transform populates the event on the form. Creation of the default event occurs when the user selects the flow action or occurs automatically if the flow action is the default action for the assignment.
When you configure a flow action with a pre-processing action, Pega Platform™ performs the action whenever a user selects the flow action and each time the user is presented with the assignment. In the use case for a trip case type, if the user completes the assignment and later returns to the assignment — for example, to update the details of their trip — the event repopulates on the form. Add logic to a pre-processing data transform or activity to test whether to perform the action.
Post-processing action use case
Another common use case for post-processing is when the billing address of a customer is also the shipping address. A data transform copies the property values from the billing address page to the shipping address page when a box is selected. You add the data transform to the flow action as a post-processing action. When the user submits the form, the application copies the contents of the billing address page to the shipping address page.
When you configure a flow action with a post-processing action, Pega performs the action each time you perform the action. In the previous example of a billing address, each time the user submits the billing address form, Pega Platform performs the post-processing action to copy the billing address to the shipping address.
Check your knowledge with the following interaction:
Pre- and post-processing configuration considerations
Pre- or post-processing action type
You can specify a data transform or activity as a pre- or post-processing action. Additionally, if you are using robotic desktop automation (RDA), you can specify a robotic automation as a pre- or post-processing action. Analyze the requirement and case type to determine which type of pre- or post-processing action is appropriate and the appropriate location. Use a data transform to copy or transform data, an activity to run a series of sequential steps, and a robotic automation to receive or send data that users enter in a case form to all the applications that are running on a user's desktop.
Note: Limit the use of activities when possible.
If you decide to use multiple pre- or post-processing actions, consider the sequence in which the system runs different actions. For pre-processing, the system first applies a data transform, runs an activity, and then runs an automation. For post-processing, the system first invokes an automation, applies a data transform, and then runs an activity.
Flow action likelihood value
For a pre-processing action, another consideration is the flow action likelihood value. Pega loads the flow action with the highest likelihood by default, so a pre-processing action on the flow action automatically runs when the user reaches an assignment.
Reuse
Consider the possibility of reuse. If a pre- or post-processing action applies to only one case type, then specialize the flow action for the case type instead of adding the pre-or post-processing action.
Check your knowledge with the following interaction:
This Topic is available in the following Module:
If you are having problems with your training, please review the Pega Academy Support FAQs.
Want to help us improve this content?