Group Approval in workflow via Workflow Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 12:04 PM
Hi guys!
I am struggling with an approval in a workflow.
So, I want to send an approval to a group based on list collector field 'u_group_name' .
I am trying to accompling this with a script in the Approval - Group action in the workflow, but the approval just won't get sent.
I have tried several varieties of the script, and the script runs correctly, but the approval won't send..
answer = [];
var list = current.variables.u_group_name.toString();
gs.info('hcv: ' + list);
var listSplit = list.split(',');
gs.info('listsplitGrps: ' + listSplit);
for (var i = 0; i < listSplit.length; i++) {
var softwareRef = new GlideRecord('u_conduktor_summary');
softwareRef.addQuery('sys_id', listSplit[i].trim()); // Replace with actual field name and condition
softwareRef.query();
while (softwareRef.next()) {
var grp= softwareRef.u_servicenow_group_approval.toString();//reference field
answer.push(grp);
}
gs.info('Answer arraygrp is: ' + answer);
}
Answer arraygrp is: ab2af634db49e4d4a00983133996192e
I'm getting the correct sys id of group in scripts but its not setting in workflow .Please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 01:16 PM
Thanks Brad I figured out the issue it was my bad passed wrong variable name .Thanks for your guidance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 03:02 PM
Ah! That will do it every time. Glad you got to the solution!