Add user to 4 groups from runscript

tejasistla
Tera Contributor

Hi Folks,

 

I have a reference variable in a Catalog form which is hidden on the form but displays on the RITM level.

 

Requirement :

 

I need to add that particular user to 6 groups which are not dynamic.(Group1,G2,g3,g4,g5,g6)

 

Please suggest.

2 REPLIES 2

Uncle Rob
Kilo Patron

What have you tried so far?

I have written the below script, which will add the user in single group and it is working.

Could you please help me with the logic to add 3 more groups.

 

var userid = current.variables.new_factory_track_account;
var groupid = "c2135dd81b9ed1d4a291edb2b24bcbc2";
var gr = new GlideRecord('sys_user_grmember');
gr.initialize();
gr.user = userid;
gr.group = groupid;
gr.insert();