Workflow Events: To Use an Existing Event
The following activity will walk you through the process of creating a workflow event handler for an existing workflow event and implementing a transition that is triggered by this event.
Story
Suppose that on the Repair Work Orders (RS301000) form, a repair work order should be assigned the Paid status when the invoice created for the order is fully paid—that is, when the invoice is assigned the Closed status. You need to implement the needed changes for this system behavior.
Process Overview
To change the status of the repair work order from Completed to Paid,
you will use an existing workflow event that is fired when the invoice document is
assigned the Closed state. First, you will explore the code of the Invoices (SO303000) form to find the workflow
event that is fired. Then, in your extension library, you will create a workflow
event handler for this event, bind it to the workflow on the Repair Work Orders
(RS301000) form, and implement the transition. You will also implement the
Paid
workflow state and override the Persist
method on the Invoices form.
System Preparation
Make sure that you have done the following:
- Prepared an instance with the PhoneRepairShop customization project and enabled the workflow validation by performing the following activities:
- Prepared the screen configuration and defined the set of workflow states by performing the Screen Configuration: To Prepare a Screen Configuration for a Form Without a Predefined Workflow activity.
- Implemented the
Completed
workflow state by performing the Workflow States: To Define a Workflow State activity. - Implemented the
CreateInvoice
action by performing the Workflow Actions: To Configure the Conditional Appearance of the Action activity.