Add user to 4 groups from runscript
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 01:07 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 01:24 PM
What have you tried so far?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 01:41 PM
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();