Using Set Service Request Status in a workflow
Notify a user at critical points during a process by updating the status that appears in the user's activity timeline. As a catalog administrator, you can use the Set Service Request Status element to inform the user of the progress of a process until the request is completed.
The following illustration shows a workflow that sets the service request status before calling a request approval process, and then sets a custom message based on the result of the approval request. You can follow these steps to use Set Service Request Status at any point in a workflow.
Before you begin
- Review the table of allowed status enumeration values on Setting the service request status.
- In the Catalog console, create a workflow that calls the Request Approval process based on Workflow to request approval, that includes:
- A variable to use for the service broker context. See Adding a process context variable to a workflow.
- An exclusive gateway (3) to direct the sequence flow between options. See Control of workflow with gateways.
To set the status before sending the request for approval
- From the Service Broker section in the palette, drag Set Service Request Status (1) onto the canvas in front of the Call Request Approval process (2).
- Change the label to Set Service Status 1, or another label that you prefer, and then press Tab or click another field to save the change.
Open the expression builder and click Next > after populating each of the following fields:
Parameter Value Notes Request Id Service Request ID
Expand the service broker context variable. Status "WAITING_FOR_APPROVAL" The request status will display "Waiting Approval". Sub Status (Leave blank) Not used. Status Reason (Optional) "Sending request for approval." Custom text string to show the user. - Click OK to save the parameters.
To set the status when the request is approved
- From the Service Broker section in the palette, drag Set Service Request Status (4) onto the canvas after the Call Request Approval process (2) .
- Change the label to Set Service Status 2, or another label that you prefer, and then press Tab or click another field to save the change.
Open the expression builder and click Next > after populating each of the following fields:
Parameter Value Notes Request Id Service Request ID
Expand the service broker context variable. Status "APPROVED" The request status will display "Approved", in addition to the default approval label. Sub Status (Leave blank) Not used. Status Reason (Optional) "Your request was approved." Custom text string to show the user. - Click OK to save the parameters.
- Connect a sequence flow from the gateway (3) to Set Service Status 2 (4) .
- Change the label to Approved, or another label that you prefer, and then press Tab or click another field to save the change.
Under Condition, open the expression builder and add the following condition that uses the result of the approval process:
- Click OK to save the parameters.
To set the status when the request is rejected
- From the Service Broker section in the palette, drag Set Service Request Status (5) onto the canvas after the Call Request Approval process (2) .
- Change the label to Set Service Status 3, or another label that you prefer, and then press Tab or click another field to save the change.
Open the expression builder and click Next > after populating each of the following fields:
Parameter Value Notes Request Id Service Request ID
Expand the service broker context variable. Status "REJECTED" The request status will display "Rejected", in addition to the default approval rejection label. Sub Status (Leave blank) Not used. Status Reason (Optional) "Your request was rejected." Custom text string to show the user. - Click OK to save the parameters.
- Connect a sequence flow from the gateway (3) to Set Service Status 3 (5) .
- Change the label to Approved, or another label that you prefer, and then press Tab or click another field to save the change.
Under Condition, open the expression builder and add the following condition that uses the result of the approval process:
- Click OK to save the parameters.
To set the status in case of an error
The request approval process could return an error; for example, if the user has not been assigned a manager. In a development or testing environment, you can display the error message in the activity timeline by updating the service request status.
- From the Service Broker section in the palette, drag Set Service Request Status (6) onto the canvas after the Call Request Approval process (2) .
- Change the label to Set Service Status 4, or another label that you prefer, and then press Tab or click another field to save the change.
Open the expression builder and click Next > after populating each of the following fields:
Parameter Value Notes Request Id Service Request ID
Expand the service broker context variable. Status "SUSPENDED" The request status will show as "On Hold" in the user's activity timeline. Sub Status (Leave blank) Not used. Status Reason (Optional) Reason
Expand the request approval activity.
Note: This response parameter displays the error message as a JSON text string. While it is appropriate for use in development and testing, do not display this response in a production system.
- Click OK to save the parameters.
- Connect a sequence flow from the gateway (3) to Set Service Status 3 (6) .
- Change the label to Error, or another label that you prefer, and then press Tab or click another field to save the change.
- Do not set a condition. An exclusive gateway must include one sequence flow to use as the default.
To complete the workflow so the process can be tested
At this point, the workflow is incomplete. If you were to save the workflow at this stage, the workflow would not be valid, and would be saved in a disabled state. You must complete the workflow by connecting all sequence flows to the end marker by inserting a non-blocking join.
- From the Gateways section in the palette, drag an Exclusive Gateway onto the canvas after the three Set Service Request Status elements.
- Connect a sequence flow from each Set Service Request Status element to the Exclusive Gateway.
- Connect a sequence flow from the Exclusive Gateway to the End.
- Click Save to exit the workflow.
Connect the workflow to a service to request from the end user console, and test the different request approval options.
Comments
Log in or register to comment.