- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2018 07:40 AM
Hello,
I am trying to write a script to add a "Type" to all our assignment groups. I want to add the "Westar" type to the Type field for all existing assignment groups.
I'm not sure how to code to add the "Westar" type into the List Collector:
var t = new GlideRecord('sys_user_group');
t.setLimit(1);
t.addQuery('u_assignment_group', true);
t.query();
while(t.next()){
t.type = 'Westar';
gs.print(t.number);
}
Thank you in advance!
Laurie
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2018 09:27 AM
Please try below script.
var grp = new GlideRecord('sys_user_group');
grp.query();
while(grp.next())
{
grp.type = grp.type + ",1cb8ab9bff500200158bffffffffff62"; // replace with Westar sys_id
grp.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2018 08:10 AM
There is a list of values in the Group Type list collector. I am trying to add one of the Group Types to all of the groups. We are going through a merger and want to be able to distinguish between exiting groups, and new groups for the new company. We do not want to use "smart names" for the group name, and later have to update all the names, once the dust settles.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2018 08:12 AM
That didn't answer most of my questions, but I think my reply should still get you what you're looking for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2018 09:27 AM
Please try below script.
var grp = new GlideRecord('sys_user_group');
grp.query();
while(grp.next())
{
grp.type = grp.type + ",1cb8ab9bff500200158bffffffffff62"; // replace with Westar sys_id
grp.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2018 09:54 AM