Bulk update group type in Group
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2023 03:51 AM
Hi
I'm searching for the best method to bulk update the group type in the Group table without impacting the existing group types that are already there in each Group. I believe using a fix script would be the best approach, but I would like to confirm this. Perhaps there are different approaches that might also work.
var gr= new GlideRecord('sys_user_group');
gr.addQuery('name', 'STARTSWITH', 'Analysts');
gr.query();
while (gr.next()) {
var currentGroupTypes = gr.getValue('type') ? gr.getValue('type').split(',') : [];
var groupTypeAnalysts= '0e5d938a4700211062a7a446926d43e9'; // new group type that I want to add
currentGroupTypes .push(groupTypeAnalysts);
gr.setValue('type', currentGroupTypes.join(','));
gr.update();
}
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2024 06:12 AM
Did you get confirmation of this, or an alternate solution?