Create a flow
Automate the workflow for the employee travel request application by creating a flow.
Avant de commencer
Role required: admin or flow_designer
Pourquoi et quand exécuter cette tâche
The second phase in adding logic and automation to the employee travel request application is to create a flow. The flow that we create automates the workflow for the application after an employee travel request is created.
|
Phase 1 |
|
|
|
Phase 2 |
|
For more information about flows, see Building flows.
Use the following tutorial to create a flow for the employee travel request application.
| Timestamp | Section |
|---|---|
| 0:09 | Add a flow to your application. |
| 0:14 | Build the flow from scratch. |
| 0:17 | Enter a unique name and description for the flow. |
| 0:22 | Continue setting up your flow. |
| 0:25 | Create a trigger. |
| 0:41 | Add an Ask for Approval action. |
| 1:09 | Add If flow logic. |
| 1:25 | Integrate decision tables. |
| 1:48 | Duplicate repeating actions. |
| 2:17 | Add an Update Record action. |
| 2:38 | Add Else flow logic. |
| 2:50 | Add a Send Email action. |
| 4:14 | Add End Flow flow logic. |
| 4:19 | View your flow as a diagram. |
| 4:22 | Save your changes. |
Procédure
Résultats
You have created a flow that will automate the end-to-end workflow for the employee travel request application.
Que faire ensuite
Continue building the flow for the employee travel request application. Proceed to the next step: Add an Ask for Approval action.
Add an Ask for Approval action
Request approvals for any record by adding the Ask for Approval action to your flow.
Avant de commencer
Role required: admin or flow_designer
Pourquoi et quand exécuter cette tâche
The Ask for Approval action is a ServiceNow Core action template that enables you to request approvals easily. You can specify which records require approval and assign users to approve or reject the record.
In our tutorial, we use the Ask for Approval action to request approvals from both managers and regional head for employee travel requests. This procedure outlines the Ask for Approval action that routes to the manager. The procedure for creating the Ask for Approval action that routes to the regional head is outlined in Duplicate repeating actions.
For more information about the Ask for Approval action, see Ask for Approval action.
Procédure
Que faire ensuite
Proceed to the next step: Add If flow logic.
Add If flow logic
Use If flow logic to direct your flow to perform actions based on specific conditions.
Avant de commencer
Role required: admin or flow_designer
Pourquoi et quand exécuter cette tâche
Add If flow logic to your flow to have your application perform actions only when certain criteria are met. If flow logic creates a specific path, or branch, within a flow that runs only when the conditions are met.
In our tutorial, we use If flow logic to define what the application does if a travel request has been approved. For example, if a travel request has been approved by the regional head, the State of the travel request record should be changed to Closed complete.
There are two instances of If flow logic in the flow in the app creation tutorial: One that represents manager approval and another that represents regional head approval. This procedure covers creating the branch that represents manager approval. You can use this procedure to create the branch that represents the regional head approval and adjust the Column label and Condition field values accordingly.
For more information about using If flow logic, see If flow logic.
Procédure
Résultats
By default, If flow logic has no output. It simply evaluates whether a condition is met or unmet. To have your flow complete actions when the conditions in the If flow logic are met, you must add branching actions or flow logic.
Que faire ensuite
Proceed to the next step: Integrate decision tables.
Integrate decision tables
Integrate decision tables into your flow using Make a decision flow logic.
Avant de commencer
Role required: admin or flow_designer
Pourquoi et quand exécuter cette tâche
Make a decision flow logic enables you to integrate decision tables within flows easily. Make a decision flow logic runs the decision table and returns results, which can be displayed as branches in the flow or data pills in the Data panel.
In our tutorial, employee travel requests are sent to the regional heads after receiving manager approval. We use Make a decision flow logic to connect the flow to the regional head decision table and retrieve the correct regional information.
For more information about Make a decision flow logic, see Make a decision flow logic.
Procédure
Résultats
The Make a decision flow logic generates results from the decision table, which you can use in your flow.
Que faire ensuite
Proceed to the next step: Duplicate repeating actions.
Duplicate repeating actions
For actions that repeat within your flow, save time by duplicating the actions and adjusting their values as needed.
Avant de commencer
Role required: admin or flow_designer
Pourquoi et quand exécuter cette tâche
Duplicating actions enables you to build flows more quickly and efficiently.
- The Ask for Approval action repeats to request both the manager and regional head approvals for employee travel requests.
- The Update Record action updates the travel request record at several places in the flow, such as when the request is rejected by a manager.
- The Send Email action occurs in two places to notify employees that their travel requests have been rejected by either the manager or the regional head.
This procedure outlines duplicating the Ask for Approval action to request regional head approval. You can use the steps outlined here to duplicate the other actions that repeat and adjust the action location and field values accordingly.
Procédure
Que faire ensuite
Proceed to the next step: Add an Update Record action.
Add an Update Record action
Automate record updates in a flow using the Update Record action.
Avant de commencer
Role required: admin or flow_designer
Pourquoi et quand exécuter cette tâche
The Update Record action is a ServiceNow Core action template that you can add to your flow to update existing records.
In our tutorial, we use the Update Record action to update the travel request record after it has been approved or rejected. This procedure outlines creating the Update Record action if a travel request has been approved by the manager and regional head. You can use this procedure to create the other Update Record actions and change the fields and field values as needed.
For more information about the Update Record action, see Update Record action.
Procédure
Que faire ensuite
Proceed to the next step: Add Else flow logic.
Add Else flow logic
In flows with If flow logic, add Else flow logic to create alternate paths when conditions aren’t met.
Avant de commencer
Role required: admin or flow_designer
Pourquoi et quand exécuter cette tâche
Add Else flow logic to define the actions that your flow performs when If flow logic conditions aren't met. Else flow logic creates a path in the flow that runs only when the If flow logic conditions aren’t met.
In our tutorial, we add Else flow logic to specify what happens when a travel request is rejected by either a manager or regional head.
Procédure
Résultats
By default, Else flow logic has no output. It just creates a branch for the flow to run when the If flow logic conditions aren't met. To have your flow complete actions in the Else flow logic block, you must add branching actions or flow logic.
Que faire ensuite
Proceed to the next step: Add a Send Email action.
Add a Send Email action
Automate sending email notifications using the Send Email action.
Avant de commencer
Role required: admin
Pourquoi et quand exécuter cette tâche
The Send Email action is a ServiceNow Core action template that you can add to your flow to automate sending emails to specified users or groups.
In our tutorial, we add Send Email actions to notify employees that their travel requests have been rejected. This procedure covers the Send Email action that notifies employees that their travel request has been rejected by the regional head. You can use this procedure to create the other Send Email action for the manager rejection and adjust the field values accordingly.
For more information about the Send Email action, see Send Email action.
Procédure
Que faire ensuite
Proceed to the next step: Add End Flow flow logic.
Add End Flow flow logic
Add End Flow flow logic to stop running the current flow.
Avant de commencer
Role required: admin
Pourquoi et quand exécuter cette tâche
If you want your flow to end when certain conditions are met, you can add End Flow flow logic. End Flow flow logic can be contained within a conditional flow logic block, such as an If, Else If, or Else flow logic. End Flow flow logic stops running the current flow.
In our tutorial, we add End Flow flow logic to end the flow if a travel request has been rejected.
For more information about End Flow flow logic, see End Flow flow logic.
Procédure
Que faire ensuite
The logic and automation for the employee travel request application are complete. Proceed to the final step in the app creation tutorial: Test your application.