Auto Incident Assignment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2024 02:06 AM
Requirement: Populate the Assignment Group based on the selected values of the category and subcategory fields.
The Assignment Group is a mandatory field in the incident form.
Create an Assignment Rule and a Business Rule to set the value for the Assignment Group. However, these auto-assignment rules only set the Assignment Group after saving the incident, not before. Given that the Assignment Group is mandatory, how can I achieve the requirement of auto-assignment?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2024 02:41 AM - edited ‎05-23-2024 02:57 AM
Hi @Sandhya23 ,
You can create onchange client script on subcategory field and call script include and pass the values category and subcategory and in script include based on the values received return the assignment group sysid after this in the client script set the value of assignment group.
Client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var categoryValue = g_form.getValue('category');
var subcategoryValue = g_form.getValue('subcategory');
var ga = new GlideAjax('getAssignmentGroup');
ga.addParam('sysparm_name', 'getSysid');
ga.addParam('sysparm_categoryValue',categoryValue);
ga.addParam('sysparm_subcategoryValue',subcategoryValue);
ga.getXML(getResponse);
}
function getResponse(response) {
var ans = response.responseXML.documentElement.getAttribute('answer');
alert(ans);
g_form.setValue('assignment_group',ans);
}
Client callable Script include:
var getAssignmentGroup = Class.create();
getAssignmentGroup.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getSysid: function(){
var cat = this.getParameter('sysparm_categoryValue');
var subCat = this.getParameter('sysparm_subcategoryValue');
if (cat == 'software' && subCat == 'email'){
return gs.getProperty('assignment.rule.for.incident'); //store the group sysid in the property and call here
}
},
type: 'getAssignmentGroup'
});
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2024 04:24 AM
Thank you Swathi for your input.
This script looks for the assignment group sys_id in a system property. Since I have multiple combinations of category and subcategory that need to match with different assignment groups, does that mean I should create a system property entry for each assignment group?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2024 04:40 AM
@Sandhya23 , yes if you have many you have many combination then you have to create that many property and call it in script include
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2024 04:26 AM
Hi @Sandhya23
It is easy and straight forward, have look here.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************