Monitoring alert business rule for mid servers

Andrew_TND
Mega Sage
Mega Sage

Hello, wondering if anyone can help me. 

I've created a business rule to monitor our mid servers, so if a mid's status changes to "Down" this will trigger an incident. It's pretty simple but does the trick and is populating all the fields as desired... Bar one, I'm having issues with adding the mid server name to the cmdb_ci field (which does exist in the pick list). Any thoughts on 
what I can do to remedy this?

(function executeRule(current, previous /*null when async*/) {

var inc = new GlideRecord('incident');
	inc.cmdb_ci = current.name.getDisplayValue(); //<<--- This line here.
	inc.category = "server";
	inc.subcategory = "other";
	inc.business_service = "9cac00421b38f4101666ecade54bcbd3";
	inc.assignment_group = "36382a06db077f0010de6c16ca96191e";
	inc.caller_id = "7c7c21791b07555045cf404cd34bcbc5";
	inc.contact_type = "monitoring";
	inc.short_description = "Mid server: "+ current.name + " is down";
	inc.description = current.name + " is down, review information and work to resolve any issues." + " stopped: " + current.stopped + " Last refreshed: " + current.last_refreshed;
	inc.insert();
	
})(current, previous);




1 ACCEPTED SOLUTION

Mike_R
Kilo Patron
Kilo Patron

Have you tried using setDisplayValue

inc.setDisplayValue('cmdb_ci', current.name.getDisplayValue() );

View solution in original post

2 REPLIES 2

Mike_R
Kilo Patron
Kilo Patron

Have you tried using setDisplayValue

inc.setDisplayValue('cmdb_ci', current.name.getDisplayValue() );

Andrew_TND
Mega Sage
Mega Sage

Worked a treat! Thank you!