Set Assignment Group in INC from Alert when Alert is ReOpen

Henrik Jutterst
Tera Guru

I have added the Assignment Group field to the Alert form and done some modifications to the Script Include so that it should use the Assignment Group on the Alert record when it's creating an incident record and assign the INC to the same group as the assignment group on the Alert record.

HenrikJutterst_0-1683719566429.png

 

 

This works fine when I create a Quick Incident from an Alert, but if I change the Assignment Group on the Alert and Create a new Incident, it copies the old assignment group instead of using the assignment Group on the Alert record.

 

Question:
Where can I change so that reopened incidents use the Assignment Group from the Alert record and not the Assignment Group from the previous Incident?

 

Here is the a part of the script I added in the script include "EvtMgmtCustomIncidentPopulator"

 

 

EvtMgmtCustomIncidentPopulator.populateFieldsFromAlert = function(alert, task, rule) {
    // Usage example:
    // task.short_description += ' source: ' + alert.source;
    // return true;

    var usr = gs.getUserID();

    task.caller_id = usr;
	task.opened_by = usr;
    task.category = "technical_Incident";
    task.subcategory = "not_applicable";
    task.contact_type = "event";

	task.urgency = 3;
	task.impact = 3;

	task.short_description = alert.description;
	task.description = alert.description;
	task.cmdb_ci = alert.cmdb_ci;

	if(!alert.assignment_group.nil() || !alert.assignment_group == '' || !alert.assignment_group == undefined){
		//set assignment group on INC from Alert record
		task.assignment_group = alert.assignment_group.support_group;
	}
	else{
		//default to assignment group of CI if no group is set on Alert record
		task.assignment_group = alert.cmdb_ci.support_group;
	}


	//url in work notes back to alert from INC.
	var url = '[code]<a href="' + gs.getProperty('glide.servlet.uri') + '/em_alert.do?sys_id=' + alert.sys_id + '">' + current.number + '</a>[/code]';
	task.work_notes = 'Created from ' + url + ', using Quick Incident button';

	return true;

 

 

 

 

1 ACCEPTED SOLUTION

Henrik Jutterst
Tera Guru

I tried to create a Business Rule to look up INC when a new was created and then update the Assignment Group on that. But I had issues with that solution because the Script Include ran later and reverted to the OOB Assignment Group.

 

The solution that i went for was to leave OOB Script Include  (in case the feature will come later). The BR that I created did not work as intended and instead of setting a sleep in BR, I used an already existing Alert Management Rule with a SubFlow to update the Assignment Group on the INC from the Alert. But since it was a flow, I put a wait for 10 seconds before the update and that solved the issue for me.

 

Again, I'd really like to see an update or property for Assignment Group from ServiceNow, but nothing to be found at the moment.

View solution in original post

4 REPLIES 4

SNUG AM
Tera Guru

Hi Henrik,

 

You need to write BR to clear assignment group when alert is closed this way you can have new assignment group as per alert calls. 

 

Regards, 

Anand.

Thanks for the comment @SNUG AM 

Not sure about this because this will have effect if there are reporting for incidents where Assignment Group is used. So, not really an ideal solution if you ask me. 

SNUG AM
Tera Guru

Hey Henrik,  

It won't affect your report. As incident was unlinked when alert closed. And reporting won't affect as you doing reporting on the Incident table. 

Henrik Jutterst
Tera Guru

I tried to create a Business Rule to look up INC when a new was created and then update the Assignment Group on that. But I had issues with that solution because the Script Include ran later and reverted to the OOB Assignment Group.

 

The solution that i went for was to leave OOB Script Include  (in case the feature will come later). The BR that I created did not work as intended and instead of setting a sleep in BR, I used an already existing Alert Management Rule with a SubFlow to update the Assignment Group on the INC from the Alert. But since it was a flow, I put a wait for 10 seconds before the update and that solved the issue for me.

 

Again, I'd really like to see an update or property for Assignment Group from ServiceNow, but nothing to be found at the moment.