- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:31 AM
Hi Team,
Am learning on service catalog module as i am new to it. While praticing like workflow is getting cancelled.
Iam trying to create subflow and add user to group via run script. All conditions are working properly but scripts are failing Please help me to learn and fix.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:46 AM
Hi,
Please update your script like below and see added comments added for your typo error:
var grMem=new GlideRecord('sys_user_grmember');
grMem.initialize();
grMem.user=current.variables.requested_for.toString();
grMem.group=current.variables.add_group.toString(); //previously it was - current.variables.add_group;
grMem.setWorkflow(false);
grMem.insert();
Also what is the type of Variables on form? Reference or List collector for both variables?
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:34 AM
Can you please share your script?
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:39 AM
Hi Anil,
For adding users to group i tried
var gr=new GlideRecord('sys_user_grmember');
gr.initialize();
gr.user=current.variables.requested_for;
gr.group=current.variable.add_group;
gr.setWorkflow(false);
gr.insert();
for pushing group approval:
answer = [];
answer.push(current.variables.add_group);
For both scripts if i use its coming as workflow cancelled for both activity

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:46 AM
Hi,
Please update your script like below and see added comments added for your typo error:
var grMem=new GlideRecord('sys_user_grmember');
grMem.initialize();
grMem.user=current.variables.requested_for.toString();
grMem.group=current.variables.add_group.toString(); //previously it was - current.variables.add_group;
grMem.setWorkflow(false);
grMem.insert();
Also what is the type of Variables on form? Reference or List collector for both variables?
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2023 08:35 PM
Thanks my bad i missed tostring.
It worked now.
Also i replaced wait for condition with Join and workflow is excueted.
Not sure Why wait for condition causing this issue.
Thank You