
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2018 06:00 PM
Hi, I am currently creating a catalog request to have our users request access to a ServiceNow assignment group through a form on the catalog and add this to their ServiceNow user account. I don't know what activity I can use in a workflow to automate this. We currently have Orchestration enabled. What would be the best way to accomplish this?
Thanks
-Julio
Solved! Go to Solution.
- Labels:
-
Orchestration

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2018 05:11 PM
Try this
var grpArr = current.variables.groups.toString().split(',');
for (var i=0;i<grpArr.length;i++)
{
var grm = new GlideRecord('sys_user_grmember');
grm.addQuery('group',grpArr[i]);
grm.addQuery('user',current.variables.requested_for);
grm.query();
if (!grm.next())
{
grm.group =grpArr[i];
grm.user = current.variables.requested_for;
grm.insert();
}
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2018 06:02 PM
You dont need orchestration for this.
You just need a Run Script activity in the workflow to add a record to sys_user_grmember table.
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2018 06:22 PM
Thanks, I am not good at javascript and not sure how to start. Any tips or help?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2018 08:18 PM
Lets assume group is the variable for group and user is the variable to add user to the group.
both are reference field.
Then use Run script as below in the workflow
var grm = new GlideRecord('sys_user_grmember');
grm.initialize();
grm.group = current.variables.group;
grm.user = current.variables.user;
grm.insert();
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2018 08:20 AM
Thanks, this was very helpful the only issue that I have is that it's only assigning the first assignment group. For the variable group I am using a list collector for type. When multiple groups are selected only the first group gets assigned to the users accounts. How can I modify the code to accept multiple groups?
Thank you for your help on this!
-Julio