- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2020 02:38 PM
Hello,
How to add new users to in a particular group, when a table is updated with new user.
ex: table : custome table
Group : Service Incident Group
I know for this i have to write business rule, here i'm looking for script.
Thanks and Regards,
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2020 02:47 PM
write an 'after' 'insert' and 'update' business rule in the custom table-
var gr=new GlideRecord('sys_user_grmember');
gr.initialize();
gr.group="Sys_ID of Service Incident Group";// best practice is to get the sysID using a property
gr.user=current.FIELD_NAME_WHICH_CONTAINS_THE_NEW_USER_IN_CUSTOM_TABLE;
gr.insert();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2021 07:21 AM
Good eye Jim, I did have to add the below to make it work right.
gr.addQuery('group',"sys_id_of_group");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2020 02:50 PM
You can use below,
create an after business rule
var gr = new GlideRecord('sys_user_grmember');
gr.initialize();
gr.group = '{{group_sys_id}}';
gr.user = current.user; //use field name containing user in customer table
gr.insert();