ServiceNow Flow designer to look in to a table field and send the Approvals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2025 07:50 PM
In the flow designer, I am trying to achieve a scenario where I am trying to pull all the user IDs which is inside the string field in a table and the string format is {"abcd": ["user_id1"], "efgh":["user_id2"]} and send the approvals at a time for all the user IDs .
Can anyone help me on this...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2025 08:36 PM
Hi @Vasu2 ,
I am taking incident for achieving this I have pasted the string in the incident's short description and replace user_id with actual user ids
1. I have created a flow variable
2. use set variable flow logic and assign the value to the flow variable using the script
3. use lookup records action and use user id(sys_id if sysid is used in the mentioned string) is one of
4. use ask for approval action and use the lookup records as a v
Test results
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2025 10:22 AM
Hi @Chaitanya ILCR
Can you help on this scenario where there are multiple Incidents are there and each incident will have Multiple Approvers. The description string format is {"Rank 1": ["user_id1"], "Rank 6":["user_id2"]}. We do not have to sent the approval if the string contains "Rank 25" and above Rank like "Rank 26". We have to send the Approval for only the userIDs which has the rank below 25. We need to send the Approvals for all the incidents at a time, If there are multiple Approvals for a Incident, anyone can Approve or Reject. If anyone Approves the rest of Approvals for that Incident is not required.
Thanks,
Vasu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2025 10:49 AM
Hi @Vasu2 ,
Update the set flow variables flow logic's script with below and try
var res = [];
var desc = fd_data.trigger.current.description.toString();
//assuming the record is the trigger and field is description feel free to update them
//test string '{"Rank 1":["Hello"],"Rank 2":["fjalf"],"Rank 3":["fadfa"],"Rank 25":["080"],"Rank 26":["26"]}'
desc = JSON.parse(desc);
for (i in desc) {
var tempAr = i.split(' ');
if (tempAr.length > 1) {
var index1 = tempAr[1];
var index1Int = parseInt(index1);
if (index1 && !isNaN(index1Int) && index1Int < 25) {
res = res.concat(desc[i]);
}
}
}
return res.join();
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 11:39 AM
Hi @Chaitanya ILCR ,
The description is not there on the catalog form, only the incident number is available in the list collector field. we need to send the approval for all incident approvers at a time. The approvers for each Incident are in description field of that Incident.
Thanks in Advance