Creating a Flow in ServiceNow to automate the process of routing a newly created record for approval to the creator's manager can significantly streamline your workflows. This is a common requirement in many organizations to ensure proper authorization for tasks like requests, incidents, or custom applications.
Here's a step-by-step guide on how to create such a Flow in ServiceNow. Please note that specific steps may vary slightly depending on the version of ServiceNow your organization is using, but the overall process should remain consistent:
1. Navigate to Flow Designer
First, log into your ServiceNow instance. Once logged in, navigate to the Flow Designer. You can do this by typing "Flow Designer" in the filter navigator on the left side of your screen and selecting it.
2. Create a New Flow
In the Flow Designer interface, you will see an option to create a new Flow. Click on "New" to start.
- Enter a Name for the Flow, for example, "Approval Process for New Record."
- Optionally, add a description to detail the purpose of the Flow.
- Select the Application scope appropriately.
3. Define the Trigger
For this Flow, the trigger will be the creation of a new record in a specific table.
- Click on the "Trigger" tab, then select "New."
- Choose "Record" as Trigger type.
- Select "Inserted" as the action.
- In the "Table" field, choose the table you’re targeting (e.g., Incident, Request, or a custom table).
- Click "Save."
4. Define the Action to Get the Creator's Manager
Your next step is to get the manager of the user who created the record.
- Click "Action" in the main Flow area.
- Search for and select the Action called "Lookup Record" or a similar Action depending on the ServiceNow version. This is used to find the manager.
- Configure the Action to look up the User [sys_user] table where the "User" is the "Created by" field of the trigger record.
- You'll want to retrieve the manager’s information (usually "manager" field) from the result.
5. Define the Approval Action
Next, add the action that will create and route the approval to the manager.
- Click on "Add Action" in the then section.
- Search for the "Create Approval" action or a similar named action. Configure it by:
- Setting the "Approval for" to the record that triggered the Flow.
- Setting the "Approver" to the manager obtained from the previous action.
6. Configure the Approval Steps
You can add additional actions based on the outcome of the approval, such as sending notifications or updating the record with the approval status.
- Use the "Condition" blocks to define what should happen if the approval is Granted or Rejected.
7. Test Your Flow
Before activating your Flow, it's essential to test it to ensure it behaves as expected.
- You can use the "Test" functionality within Flow Designer to simulate the creation of a record and verify that the approval request is sent to the correct manager.
8. Activate the Flow
Once you’re satisfied with the testing, activate the Flow by toggling the "Active" switch to "Yes."
Final Notes
- Ensure that the "Created by" field is reliably populated for records in your target table, as this data is crucial for the Flow to correctly identify the manager.
- Adjust and expand your Flow as necessary, possibly including error handling or dealing with edge cases where a user might not have an assigned manager.
Remember, automating processes with ServiceNow's Flow Designer can significantly improve efficiency and consistency in operations, so it's well worth investing the time to set up and refine your workflows.