how to assign incident particular assignment group, category and subcategory through alert rule in event management

konka1
Tera Contributor

how to  assign incident particular assignment group, category and subcategory and priority through alert rule in event management.

i have created Alert rule condition is when type is xxxx and severity is xxxxx incident needs to be create particular group and category and subcategory and priority (i have used task temple but how to capture alert information into incident ex: additional information) please can any one help me on this. (need auto open incident with mentioned all values in incident form)

 

Thanks in Advance

4 REPLIES 4

Branden
ServiceNow Employee
ServiceNow Employee

EvtMgmtCustomIncidentPopulator is your friend

 

https://docs.servicenow.com/bundle/kingston-it-operations-management/page/product/event-management/concept/task-template-and-custom-script.html

 

stevemacamway
Giga Expert

To follow on to what @Branden said, here is what we have in our EvtMgmtCustomIncidentPopulator:

 

var EvtMgmtCustomIncidentPopulator = Class.create();
EvtMgmtCustomIncidentPopulator.prototype = {
	initialize: function() {
	},
	
	type: 'EvtMgmtCustomIncidentPopulator'
};

/*
 * Placeholder for custom script to assigne additional fields from the alert to the task being opened (by defualt to an incident).
 * This script is called from the EvtMgmtIncidentHandler script include.
 * @param alert - alert
 * @param task - any derivitive of 'task', as defined by the rule, such as incident, problem, etc. By default this will be an incident.
 * @param rule - the rule that triggered creating the incident for the alert. It can be empty - in case of manual incident creation from alert
 * @return - true if task creation should be continued, false - if task creation should be aborted
 */
EvtMgmtCustomIncidentPopulator.populateFieldsFromAlert = function(alert, task, rule){
	// Usage example:
	// task.short_description += ' source: ' + alert.source;
	// return true;
	
/****************************************************************************************
** Set the Incident Assignment Group                                                   **
****************************************************************************************/
	//find the cmdb_ci record for the CI referenced in the alert
	var grCI = new GlideRecord('cmdb_ci');
	grCI.get("sys_id", alert.cmdb_ci);
	
	//Get the Support Group for the CI
	var sSuppGroup = grCI.support_group;
	
	//If the sSuppGroup is blank, set it to the CI's assignment group.
	if(!sSuppGroup) {
		sSuppGroup = grCI.assignment_group;
	}
	
	//if the sSuppGroup is still blank, set it to the Operations group.
	if (!sSuppGroup) {
		//Open a glide record on the
		var grGroup = new GlideRecord('sys_user_group');
		grGroup.get("name", "IT OPERATIONS");
		
		if(grGroup.sys_id){
			sSuppGroup = grGroup.sys_id;
		}
	}
	
	//if the sSuppGroup variable is not blank, set the Incident Assignment Group to it.
	if (sSuppGroup) {
		task.assignment_group = sSuppGroup;
	}
/****************************************************************************************
** END: Set the Incident Assignment Group                                             **
****************************************************************************************/
	
/****************************************************************************************
** Set the Impact & Urgency to create the correct Priority                             **
****************************************************************************************/
	switch(alert.severity.toString()) {
		case "5":  //Info - set Priority to Low
			task.impact = "3"; //Low
			task.urgency = "3"; //Low
			break;
		case "4":  //Warning - set Priority to Low
			task.impact = "3"; //Low
			task.urgency = "2"; //Moderate
			break;
		case "3":  //Minor - set Priority to Moderate
			task.impact = "2"; //Moderate
			task.urgency = "2"; //Moderate
			break;
		case "2":  //Major - set Priority to High
			task.impact = "1";  //High
			task.urgency = "2"; //Moderate
			break;
		case "1":  //Critical - set Priority to Critical
			task.impact = "1";  //High
			task.urgency = "1"; //High
			break;
		default: //Unrecognized value - set Priority to Moderate
			task.impact = "2"; //Moderate
			task.urgency = "2"; //Moderate
	}
	
/****************************************************************************************
** END: Set the Impact & Urgency to create the correct Priority                         **
****************************************************************************************/

/****************************************************************************************
** Include the Alert 'Source' field at the end of the Incident Description field       **
****************************************************************************************/
	
	task.description = alert.description + "\n\n[Source :" + alert.source + "]";
	task.caller_id = "9d5de9e5930022005bc5f179077ffb07";
	task.contact_type = "Alert";

/****************************************************************************************
** END: Include the Alert 'Source' field at the end of the Incident Description field  **
****************************************************************************************/

};

Thank You Steve.
let me try...

Vishal Khandve
Kilo Sage

Hi,

Write a BR on alert table. so additional info will capture on Incident Form.

 

Thank you