
- 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
09-07-2018 09:15 PM
It worked. Thanks!
-Julio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2018 02:03 PM
Hi Julio,
Take a look here. Steven done a great job creating this Mini-lab which pretty much does what you are looking for:
//Göran

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2018 04:00 PM
Thanks, but I still can't get my script to work. It doesn't add any groups. This is what I have so far for the run script.
var grm = new GlideRecord('sys_user_grmember');
grm.initialize();
grm.group = current.variables.groups + '';
grm.user = current.variables.requested_for;
var groupList = [];
// if we have more than one they will be comma delimited
if (grm.group.indexOf(',') > -1) {
groupList = group.split(',');
grm.insert();
}
else {
groupList.push(grm.group); // only one group
grm.insert();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2018 08:49 AM
This is what I have so far. I can't get the below code to add the groups to the user in ServiceNow. Can someone check to see what I am doing incorreclty?
var grm = new GlideRecord('sys_user_grmember');
grm.initialize();
grm.groups = current.variables.groups + '';
grm.user = current.variables.requested_for;
var groupList = [];
if (grm.groups.indexOf(',') > -1) {
groupList = grm.groups.split(',');
grm.insert();
}
else {
groupList.push(grm.groups); // only one group
grm.insert();
}
Thanks
-Julio