Approval action in workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2023 02:16 AM
Hi all,
I have a requirement in ServiceNow workflow.
In the catalog item there is a variable to get the group name the user want to be added to. It can be multiple values.
So, in the workflow how can I add the approval action which should take the data from the variable and split it and then send the approval request to the respective group managers?
Thank you in advance!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2023 02:28 AM
Hi,
You can achieve this requirement by using a "Loop" activity and an "Approval - User" activity in your workflow. Here's an outline of the steps you can follow:
Add a "Loop" activity to your workflow and configure it to loop through the values of the variable that contains the group names. You can use the "Split" function to split the values into an array.
Inside the loop, add an "Approval - User" activity and configure it to send an approval request to the manager of the current group. You can use a GlideRecord query to retrieve the manager's details based on the group name.
Configure the approval activity to wait for the manager's response before continuing the workflow. You can set a timeout value in case the manager doesn't respond within a certain time.
After the approval activity, add a "Decision" activity to check whether the manager approved or rejected the request. You can use the "Approval Result" variable to get the manager's response.
Based on the manager's response, you can take different actions in the workflow. For example, you can send a notification to the user if the request was approved, or you can log an error message if it was rejected.
Finally, continue the loop until all the group names have been processed.
This approach should allow you to dynamically send approval requests to the managers of the groups specified in the catalog item variable.
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2023 02:47 AM
Hi Rahul,
Thank you for the response.
Could you please help me with configuring the variable values to loop that contains the group names and a GlideRecord query to retrieve the manager's details based on the group name?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2023 03:52 AM
@2022_ServiceNow You can achieve this by using advanced script in Approval User activity. please find sample script below :