Step 3: Adding the ApproveDiscount Action
By using Workflow API, you can define actions without implementing them in a graph. You do
this by calling the ActionDefinitions.CreateNew method and specifying all
settings of the action, including the display name and category. This approach can be used
only if the action does not have complex logic. In this step, you will define the
approveDiscount action without implementing it in a graph.
To add the approveDiscount action, do the following:
- In the
SOInvoiceRepairOrder_Workflowclass, define a string constant whose value will be used as the display name for theapproveDiscountaction, as the following code shows.public const string ApproveDiscount = "Approve Discount"; - In the static Configure method of the
SOInvoiceRepairOrder_Workflowclass, add the following code.var approveDiscount = context.ActionDefinitions .CreateNew(ApproveDiscount, action => action .DisplayName("Approve Discount"));In the code above, you have defined a new action with the Approve Discount display name.
- In the WithActions method of the
UpdateScreenConfigurationFor method call, add the
approveDiscountaction, as the following code shows.actions.Add(approveDiscount);
- Save your changes.
