The CreatorCon Call for Content is officially open! Get started here.

Bulk update group type in Group

miro2
Mega Sage

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

adamwashing
Tera Contributor

Did you get confirmation of this, or an alternate solution?