Need to configure assignment rule using script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 07:16 AM
Hi All,
I have a requirement to configure assignment rule where if IT application owner is present ,then that user needs to be added to the group automatically which I have created. then that group should be selected as assignment group with assigned to field with the particular application owner. Can anyone please provide scripting to achieve this.
Thanks in advance
- Labels:
-
Vulnerability Response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 07:21 AM
Hi,
You can try below script
var gr = new GlideRecord('tablename');
gr.addEncodedQuery("give your encoded query here");
gr.query();
if (gr.next()) {
current.setValue('assignment_group', gr.getValue('group_field_name'));
}
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 06:55 PM
Hi Sumanth,
In this script the user is not automatically adding to the group which I have created, can you please give the solution for complete requirement.
Thank you,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2022 01:26 AM
Hey Kruthik,
You can try this
//this will add user to group
var grmem = new GlideRecord('sys_user_grmember');
grmem.initialize();
grmem.group = "sysid of your group";
grmem.user = "sysid of the user to be added"; //if user is present in any field then you can use current.fieldname
grmem.insert();
//this below sample script will help you to set the assignment group and assigned to.
var gr = new GlideRecord('tablename');
gr.addEncodedQuery("give your encoded query here");
gr.query();
if (gr.next()) {
current.setValue('assignment_group', gr.getValue('group_field_name'));
current.setValue('assigned_to', grmem.user);
}
//make changes to script as per your requirement.
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2022 08:58 AM
Feel free to reach out if you have further questions or else you can mark an answer as correct and helpful to close the thread so that it benefits future visitors also.
Regards,
Sumanth