This content has been archived and is no longer being maintained.

Table of Contents

Article

When and how to use mid-process dependencies

Summary

When your application has a hierarchical case structure, there may be situations where a case must wait in mid-process for a case (or cases) of another type to reach a specified assignment in its own process before the waiting case (sometimes referred to as the dependent case) can advance.

You can use a Dependency-type Assignment shape in the dependent case's process. The assignment causes that case to wait in the owner's workbasket until the other case reaches a specified work status. When this occurs, the system automatically completes the dependent assignment. and advances the process.

This article describes how to configure a a mid-process dependency in a sample application.

Suggested Approach

Example

You are working with an equipment order case management application composed of an Equipment Order top-level case and two subcase types: Ship Order and Payment.

Whenever an Equipment Order case is created, a Payment case is automatically created also. After the case worker has completed the three tasks in the payment process (receive, deposit, and settle), the worker manually creates a Ship Order case. The payment processes takes three days at minimum — one day for each task. The shipment process takes one day.

Business requirement

Process analysis shows that nearly all payments are settled after they are deposited. To expedite orders, it has been decided that the Equipment Order and Payment cases can be created and started concurrently. The shipment will be held until the payment has been deposited, at which time the waiting Ship Order case will be automatically completed and shipped.

Configuration requirement

The Ship Order case must complete its process and hold the case in a dependent workbasket assignment until a Payment case, in its own process, reaches the Deposit assignment. When that event occurs, the dependent assignment automatically initiates, advances the flow, and resolves the Ship Order case. You will:

  • In the Process Payment flow rule, add an assignment with a work status value that the Ship Order dependent assignment is waiting for.
  • In the Payment case type, create a declare trigger rule using the standard pxCheckFlowDependencies activity. When any assignment in the case type changes work status value, the activity searches for a matching status value parameter in all dependent assignments under the top-level case. When a match occurs, the assignment is initiated and the flow is advanced. In this example, the Ship Order dependent assignment, when triggered, is completed and ships the order.
  • In the Ship Order flow rule, create a dependent assignment, configure its dependency requirements, such as work status value and case type, and specify the workbasket.
  • Change Ship Order case type instantiation from manual to automatic.

Note: Mid-process dependencies can only be created among subcase types beneath the same top-level case type. To help avoid deadlock conditions, avoid parent-child dependency relationships.

Configure

Do the following:

  1. Create a field value in the of EquipmentOrder-Work Applies To class using a Field Name of.pyStatusWork, and a Field Value of Payment-Deposited.
  2. Open the Case Designer (> Process & Rules > Case Management > Case Designer).
  3. On the case types tree, select Process Payment to open the Payment case type's starter flow.
  4. Select the Deposit Payment assignment shape, and open its Assignment Properties panel.
  5. Open the Status   tab and select Payment-Deposited in the Work Status field.
  1. Close the panel and save the flow rule.
  2. Create a declare trigger rule in the Payment case type class, and select .pyStatusWork in the Property array and pxCheckFlowDependencies in the Trigger Activity area.
Note: To complete the assignment, the declare trigger rule must obtain a lock on the waiting assignment. If on the first try, it cannot acquire the lock, the task is queued to be completed later. The Process Flow Dependencies agent (System-Queue-FlowDependency-.pzProcessFlowDependency activity) periodically rechecks the lock status until a lock becomes available.
  1. Open the Ship Order flow rule and add an assignment shape to the left of the end shape.
  2. Open the Assignments properties panel and enter the following on the Assignment tab.
    • Name Awaiting Deposit
    • TypeDependency
    • Dependent OnEquipmentOrder-Work-Payment
    • Dependent StatusPayment-Deposited
    • Action to Take Shipped

26441_Dependent.png

  1. Open the Routing tab.
  2. Select ToWorkbasket in the Router field, and a workbasket.
  3. Close the panel and save the rule.
  4. In the Case Designer, select Equipment Order in the case type tree, and select Instantiation on the Details tab.
  5. In the Instantiation Settings pop-up dialog, select Automatic Instantiation for Ship Order.
  6. Click OK to close the dialog

Test

  1. Open the Case Manager portal and create an Equipment Order case from the New menu (case EQ-25, in this example). The subcases Ship Order and Payment are automatically instantiated.
  2. On the Perform user form, click the Review link.

    This opens the case's Review user form and displays the open cases and processes. The Ship Order case, assigned to the Dependency-assignment's workbasket, is waiting for the Payment case to reach a work status of Payment-Deposited. The Payment case is currently at the Receive Payment assignment.
  3. Select the Process Payment task to open the case's Perform user form. Note that its status is Payment-Received.
  4. Click Submit to advance it to the Deposit Payment assignment. The case has reached a status of Payment-Deposited.
  1. Select the Equipment Order (EQ-25) link to open its Perform form.


    The Ship Order case has been automatically completed and resolved.

Note: You can use the standard flow @baseclass-.pyWaitForCase, which employs a Decision shape and two Dependency assignments (Wait for Dependency and Wait for all Dependencies) to determine flow action outcomes for each condition. Add the flow to a Subprocess, Split For Each, or Split Join shape, and enter the flow's parameter values in the shape's Properties panel. The Decision shape uses the WaitForAllCases parameter to determine which Dependency assignment to use.

Tags:

Published February 1, 2012 — Updated October 9, 2015


84% found this useful

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.