Responding to business exceptions in a flow

You can use a ticket in a flow to respond to business exceptions, errors, or events that you define. By moving a case to a specific point in a flow, you can ensure that additional processing occurs so that the case is not left in an incomplete state.

For example, you can activate a ticket to perform cancellation tasks and send correspondence to stakeholders when a user withdraws a case.

  1. Click Configure > Case Management > Work Management > Tickets to review the tickets that are available in your application and the rules that reference them.
  2. Create a new ticket if there are no existing tickets that meet your use case.
  3. In the navigation panel of App Studio, click Case types, and then click the case type that you want to open.
  4. Set the ticket in the flow that defines your exception processing.
    1. On the Workflow tab, click Life cycle.
    2. Click a process in a stage and then click Open process.
    3. On the Diagram tab of the Flow form, double-click the shape that is the entry point for your exception processing.

      If you do not have exception processing defined, you can add shapes to the flow or create a new flow.

    4. In the Advanced section, click Tickets.
    5. Click + Add ticket.
    6. In the Ticket name field, press the Down Arrow key and select the ticket that your application or a user activates at run time.
    7. Optional: To change the label of the ticket in the flow diagram, enter a name in the Display name field.
    8. Click Submit.
    9. Click Save.
  5. Activate the ticket in a flow that detects your business exception.
    • To automatically activate the ticket:

      1. Return to the Workflow tab of your case type and click Life cycle.

      2. Click a process in a stage and then click Open process.

        You can set a ticket in one flow and raise it in another as long as both flows are in the same case.

      3. On the Diagram tab of the Flow form, add the Utility shape to the flow diagram where the exception occurs.

      4. Double-click the Utility shape and then configure it to call the @baseclass.SetTicket activity with the name of your ticket as an input parameter.

      5. Click Submit.

      6. Click Save.

    • To manually activate the ticket:

      1. Create a flow action that users perform when the exception occurs.

        Ensure that the flow action calls the standard Work-.pyActionSetTicket activity during its post processing to activate the ticket.

      2. Return to the Workflow tab of your case type and click Life cycle.

      3. Click a process in a stage and then click Open process.

        You can set a ticket in one flow and raise it in another as long as both flows are in the same case.

      4. On the Diagram tab of the Flow form, double-click an Assignment shape to open the Assignment properties dialog box.

        Tip: To make your flow action available for more than one assignment, associate it with a stage in the life cycle of the case type or the case type itself.
      5. In the Advanced section, click Local actions.

      6. Click + Add local action.

      7. In the Local Action field, press the Down Arrow key and select the name of your flow action.

      8. Click Submit.

      9. Click Save.

  6. Optional: To change the limits that prevent infinite loops in your flows, override the standard Pega-ProCom.MaxFlowEnteredCount and Pega-ProCom.MaxFlowLoopCount dynamic system settings in your application.
What to do next: 

You can test your changes by creating and processing a case that meets the conditions that cause your business exception.