Split For Each shape in pega

Parallel processing in Pega

We can allow users to perform multiple tasks independently to complete the work, in pega we can this as parallel processing. In a stage or flow rule, we can add smart shapes to achieve this parallel processing.

Smart shapes in pega

Pega has defined some smart shapes like Split JoinSplit-For-Each, and Spin-Off. We have to use these smart shapes in sub-process shape. Each shape can call one or more processes to proceed in parallel.

Split For Each shape in pega
Split for each allows us to run a single process multiple times by looping through a Page List or Page Group.
The main flow continues when processes on the PageList/PageGroup processed.
split for each shape in pega
I Will explain with an example: In a Service Request case type when the user submits a request it should be going for the inspection process. Used Split Join shape to fulfill this requirement with two sub-processes. When all sub-processes are complete, the main Service Request application process can continue to the Review stage where the management team will review the inspection report. In the Review stage, the Inspection report will be reviewed and approved by various Reviewers. To fulfill this requirement we are using Split For Each shape and providing Reviewer details in a PageList. Pega will use this PageList and iterate the process. We can define join conditions for the main flow to resume.

split for each in case type

How to configure Split For Each in pega

From the Diagram tab of flow rule - Advanced Shapes, we can choose Split For Each shape.
split for each shape in flow rule

Configure split for each shape properties by selecting PageList/PageGroup property, sub-process, and join type.
split for each shape properties

ReviewOfficers is the PageList it is formed before executing this shape. Pega will loop the page list and creates sub-processes (assignments) and assign them accordingly. 
We have three Reviewers in the PageList (ReviewOfficers ) Split For Each shape will create a "ReviewInspectionReport" process and send it to each reviewer on the list.

Join Type:
All      -     Main flow waits for each sub-processes to complete.
            Ex: Main flow (Service Request main flow) resumes after ALL the reviewers in the PageList completes their review.

 Any    -     Main flow waits for any one of the sub-process to complete. At that time, the processing of the other sub-processes that have not completed is stopped. Open assignments for these sub-processes are canceled.
           Ex: Service Request case type will resumes and moves to the next step if any of the Reviewers completes their review. In this case, other reviewers' assignments will be canceled and the process will be stopped.

Some   - Waits for a when condition to return a true value, or a specific number of flows to return a status value that you provide.
Ex: If you want to resume main flow based on a WHEN condition OR based on the Count.
On WHEN - Main flow resumes on the true result of a when rule.
On Count   - Main flow resumes after a specified number of processes completes with a specific status.
We need to define the number and status.
Ex: If you want the main flow to resume after two Reviewers Approve the assignments with a status of "Review-Approved".

Iterate - SplitForEach will loop PageList/PageGroup results in one by one and creates items one by one.
         Ex: ReviewOfficers PageList has 3 reviewers (results), pega will create an assignment for the First reviewer and once the First reviewer completes the assignment, it will iterate the page list and creates an assignment for the second reviewer and so on. To stop the loop (iteration) we can give the WHEN condition in the "Exit iteration when" field.

Note: Pega uses MaxFlowLoopCount Rule System Setting (RSS) to control the maximum number of iterations/loops to stop infinite loops. 

Let's create a Service Request case and send the inspection report to Reviewers for their review and approval. Join Type is ALL.

split for each case creation in pega

By using split for each shape, pega has created three processes (assignments) by looping PageList results. After ALL, the assignments complete, the main flow will resume and proceed further.

Related topics in parallel processing:

No comments:

Post a Comment