Auto Incident Assignment

Sandhya23
Tera Guru

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?

5 REPLIES 5

swathisarang98
Giga Sage
Giga Sage

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:

swathisarang98_0-1716458150181.png

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:

swathisarang98_1-1716458212822.png

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

 

Sandhya23
Tera Guru

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?

 

@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

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Sandhya23 

 

https://youtu.be/QPfegsMVuKg

 

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]

****************************************************************************************************************
CISITSM #ITSM #csa #ServiceNow #TechnoFuncational Disclaimer: These videos are from my training batch. These videos did not promote any ServiceNow Sales pitch or marketing. These videos are only for knowledge purposes & basic on my experience & Knowledge. Redistribution or copying of functionality