- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 02:14 PM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 06:21 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 04:04 PM
hi Roy,
if this is the case, when a user entering the form details...try to determine the criteria which will determine the existing active outage....e.g. selected service ETC.
Then, based on the on change client script, query the active outage details and prompt the error message using client script g_form.showFieldMsg...mentioned there is already an existing active outage for this "service".
The other way is to use a Before Business rule to check is there an active outage, if so, use gs.addErrorMessage to prompt the user there is already an existing active outage.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 04:38 PM
Hi Bryan,
Irrespective of the criteria, all active outages should be displaye at the top of the incident form.
So i am thinking of writing a business rule on the incident table and call it before the insert. It will query the cmdb_ci_outage table and look for all active outages. Hope it works.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 04:52 PM
I WANT this to work...but I don't think it will...
There's been many a discussion on how to get messages to show up as announcements and the like in the back-end...like how it works on the Service Portal and I've never seen this, but that doesn't mean it won't work, I would have figured that others would have suggested this previously, but who knows!
There's only the one way that I know and that's to tap in to a "hidden" system messages table and post a message that way, but it only appears when users first login and the moment they click any further in to a record or whatever, it goes away, so it usually just causes confusion than helps, lol.
Let us know! 🙂
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 04:54 PM
hi Roy,
Before Insert business rule will not fit what you want then...
If irrespective of the criteria, you may want to consider using Display business rule. then invoke
gs.addErrorMessage("Outage 1: xxxx");
do bare in mind that this will incur operation every time you user display an incident.
hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2019 05:02 PM
hi Roy,
this is what I mentioned...
Else, you might want to consider the following thread on how to trigger an announcement.
Have fun !!