How to use the Wait shape to create mid-process dependencies
Use a Wait shape in your Pega 7 process to keep assignments from advancing either:
- For a specified period of time
- Until one or more cases of another case type reach a specified work status
When an assignment reaches a Wait shape, they system automatically puts it in a dependency workbasket. When the system detects that the dependency requirements are met, it advances the case to the next action in the process.
Using a simple example, this article describes how you can employ a Wait shape in your application.
The Purchase application contains a Purchase Order case type that is comprised of three stages. In Stage 2: Vendor Addition, the operator adds the items and, for each item, specifies a vendor. If the vendor is new, the process creates a Vendor Maintenance case, indicated by the Create Vendors step shown here:
For each Vendor Maintenance case, a manager will:
- Review the case
- Accept or reject the case
- Resolve each case
In the current configuration, a Purchase Order case enters the vendor information and immediately advances the case to Stage 3: Quote, whether the vendor is approved or not.
You have been asked to design the Vendor Addition stage so a purchase order does not advance to the Quote stage until all the Vendor Maintenance cases spun off by an order are resolved.
To meet the requirement:
- In the Purchase Order case type, add a Wait for Approvals step to the Vendor Addition stage.
- In the new step, create a process that contains a Wait shape.
- In the Vendor Maintenance case type, determine the work status a case must achieve before a Purchase Order case can advance to the Quote stage.
- In the Wait shape, configure its properties.
- Test your configuration by creating a Purchase Order case.
Step 1: Add a Wait for Approvals step
- Open the Purchase Order case type from the Cases Explorer. This displays the Stages & Processes tab on the Case Designer landing page.
- In the Vendor Addition stage, add a step beneath Create Vendors step. Type the name Wait for Approvals in the text field.
- Click to the right of name and select
from the pop-up menu.
This opens the Step Configuration dialog.
- In the dialog, select Step Type field. Click OK to save your step configuration and close the dialog.
Step 2: Create a Wait shape in the Wait for Approvals step
- Click the area beneath the steps in the Vendor Addition stage to display the Configure process detail link. Click it to open the stage's process diagram in process outline view.
- In the diagram, select the Wait for Approvals flow shape in the outline tree to display the default shapes.
- Delete the Assignment shapes, right-click the canvas, and select
from the pop-up menu.
- Connect the Start and End shapes to the Wait shape. Click the default [Wait] label beneath the shape and change the name to Wait for Approvals.
- Click the Save button on the Case Designer header to save your configuration.
Step 3: Determine the dependency work status
- Select Vendor Maintenance in the Cases Explorer. On the Stages & Processes tab, click the Configure Process Details link beneath Stage 3: Closure.
This displays the Close Vendor Maintenance process diagram.
- Double-click the End shape to display its properties. Note that the Work status value is Resolved-Completed.
- Click Cancel to exit the dialog and return to the Vendor Addition Process Overview diagram.
Step 4: Configure the Wait shape's properties
- Select the Wait shape to display its properties.
- Enter the following information in these fields:
- Wait Type — Dependency. A purchase order assignment (in the dependent case) will wait in a workbasket until a specified case (s) (defined by the case type in the Case of type field) reaches a work status (defined in the To reach status field) before the system processes the waiting purchase order assignment.
- Wait for — All. A purchase order must wait for all of its sub-cases to reach the defined work status before it can continue processing.
- Cases of type — Pco-FW-PuchaseFW-Work-VendorMaintenance. This is the Vendor Maintenance sub-case type. Purchase order cases depend upon these cases reaching a specific status (defined in the To reach status field) before purchase order.
- To reach status — Resolved-Completed. The work status a vendor maintenance case must achieve before a purchase order can advance. This is the value you previously noted in Step 3: Determine dependency work status.
- Scope — Current Case. Processing searches all cases within the current case type and all its descendants when trying to fulfill a dependency. In this example, the vendor maintenance cases are sub-cases of its parent purchase request case.
The complete dialog looks like this:
- Click OK to save your edits and close the dialog.
Step 5: Test your configuration
- Create a purchase request case by selecting Purchase Request from the
- Enter two new vendors when adding two items in the Add Line Items screen flow.
- Complete the assignment. The process creates two new vendor maintenance cases for the new purchase request, PR-34. The assignment for vendor maintenance case VM-39 appears. Note that the purchase request case has not advanced to an assignment in the Purchase Request Step 3: Quote stage.
- Click the Purchase Request (PR-34) link to display its review form. Note the two new vendor maintenance assignments.
- Click the VM-39 Maintain assignment link to open its work form. Continue the process until the case is resolved.
- Open the purchase request review form again. Note that the VM-39 assignment no longer appears.
- Open and resolve the VM-38 assignment. Open the PR-34 review form again. Now that both vendor maintenance assignments have been resolved, the purchase request case has advanced to the first assignment in the Quote stage.
Allow operators to override the dependency
You can configure the Wait shape so that operators who have access to the dependency workbasket can choose to override the dependency requirement and manually advance the waiting case.
Do the following:
- Open the Vendor Addition stage in process outline view.
- Select the Wait for Vendor Approval shape on the outline tree to display the shape's properties.
- Expand the Advanced section on the form and select the Permit End User to perform checkbox.
- Click Save on the Case Designer header.
- Create a purchase request case as described previously. Note that there is an assignment in the purchase request review form named Await Vendor approval (Vendor Addition) that is assigned to the firstname.lastname@example.org dependency workbasket (defined in the Assigned to Workbasket field on the Wait shape's properties dialog).
- When the operator selects the assignment, the form displays the following in the action area:
When the operator clicks the Step waiting and continue process button, the purchase request case immediately advances to the first assignment in the Quote stage.
Published January 31, 2014 — Updated October 7, 2014