How can i add an outage banner to an incident

Roy
Kilo Contributor

Hello,

When a new incident is being created, i want to know what active outages exist in the environment so that I do not create duplicate tickets and can provide details to users reporting the same issue.

When an outage is active and a user is viewing an Incident form via the frameset, a banner message appears at the top of the form explaining that there is currently an outage. This banner should also display the affected CI and the time the outage began.

Has anyone done something like this? Any input is appreciated.

 

Thanks

1 ACCEPTED SOLUTION

siva_
Giga Guru

Try using this and it should work 

 

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

// Add your code here
gs.addInfoMessage('Entering Business Rule to display outage');

var now = new GlideDateTime(gs.nowDateTime());
var outage = new GlideRecord("cmdb_ci_outage");
outage.addQuery('type', 'Outage');
outage.addQuery("begin", "<=",now);
outage.addQuery("end", ">",now).addOrCondition("end", "=", "NULL");
outage.setLimit(5);
outage.query();
if (outage.next()) {
gs.addInfoMessage('Entering outage check to get CI value');
var outageci = outage.cmdb_ci.getDisplayValue();
gs.addInfoMessage("This is a test for outage");
gs.addInfoMessage("Outage opened for " + outageci);
}
})(current, previous);

 

Hope this helps 

Mark this response as correct if that really helps 

Thanks,

Siva

 

View solution in original post

13 REPLIES 13

Bryan Tay3
Mega Guru

hi Roy, 

It depends on how is the trigger to determine the outage...

if its based on selection of "Services", then you can achieve this by having on_change client script to query the outage details...if there is an active outage, show error message...

where is if the triggering condition is from server side, trigger an gs.addXXXXMessage to alert the user.

details:

https://docs.servicenow.com/bundle/london-application-development/page/script/general-scripting/refe...

hope this helps.

Roy
Kilo Contributor

Hi Bryan,

 

Thanks for the input. Basically any active outages should be displayed at the top of the incident form when a new incident is being created. 

hi Roy, 

In this case, perhaps u can explore on Display business rule for incident to show all active outages - this will display on every incident form.

If you want it to be display "after" an incident been created, modify the UI action for the incident creation to display all outages.

I think it is not going to be pretty on the form if you have lots of active outages...

second thought is I thought the whole idea is to prevent user from raising a duplicate incident?

Hope this helps.

Roy
Kilo Contributor

Thanks. I will try the Business Rule and see if it works. You are right, the whole idea is to prevent a user from raising a duplicate incident,