Displaying UX Banner Announcement for P1/P2 Incidents

saichary
Tera Contributor

 

Problem Statement

In our ServiceNow implementation, it is important to ensure that high-priority incidents (Priority 1 and Priority 2) receive immediate attention. The goal is to notify support teams when an incident is raised or updated to P1 or P2 via a UX banner Announcement.


Proposed Solution

To fulfill this requirement, a Business Rule has been implemented on the Incident table, triggered before Insert or Update. This rule automatically creates a UX Banner Announcement when an incident is created or escalated to Priority 1 or 2.

The Announcement:

  • Highlights the priority escalation

  • Appears for 10 minutes

  • Includes a direct link to the incident record

  • Is targeted to specific users/groups


Implementation Steps

  1. Create a Business Rule on the Incident [incident] table

    • When to Run: Before Insert or Update

    • Condition: Priority Changes to P1 OR Priority Changes to P2

    • Script: See below

  2. Script Highlights

    • Identifies if the incident is being created or updated with P1/P2 priority

    • Generates a dynamic UX banner Announcement with message, color, and URL

    • Sets the banner to display for 10 minutes

    • Links it to a UX banner configuration via sys_ux_m2m_banner_announcement


Business Rule Script

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

// Add your code here
var operation = current.operation();
var announcementGR = new GlideRecord('sys_ux_banner_announcement');
announcementGR.initialize();
announcementGR.heading = 'Priority has been escalated for Incident ' + current.number;
announcementGR.start = new GlideDateTime();
announcementGR.show_for = 'specified_users';
announcementGR.group = gs.getProperty('glide.uxbanner.group');
if (current.priority == '1' && operation == 'insert') {
announcementGR.summary = 'Incident ' + current.number + ' has been raised with Priority 1. Kindly review and take immediate action.';
announcementGR.color = 'critical';
} else if (current.priority == '2' && operation === 'insert') {
announcementGR.summary = 'Incident ' + current.number + ' has been raised with Priority 2. Kindly review and take immediate action.';
announcementGR.color = 'high';
} else if (current.priority == '1') {
announcementGR.summary = 'Incident ' + current.number + ' has been upgraded to Priority 1. Kindly review and take immediate action.';
announcementGR.color = 'critical';
} else {
announcementGR.summary = 'Incident ' + current.number + ' has been upgraded to Priority 2. Kindly review and take immediate action.';
announcementGR.color = 'high';
}
var gdt = new GlideDateTime();
gdt.addSeconds(600);
announcementGR.end = gdt.getDisplayValue();
announcementGR.add_link = 'true';
announcementGR.link_label = 'Open Ticket: ' + current.number;
announcementGR.link_url = 'https://<Your Instance Name>/now/cwf/agent/record/incident/' + current.sys_id;
announcementGR.content_position = 'center';
announcementGR.link_click_behavior = 'new';
announcementGR.insert();

var bannerGr = new GlideRecord('sys_ux_m2m_banner_announcement');
bannerGr.initialize();
bannerGr.announcement_config = gs.getProperty('glide.uxbanner.annoucement.config');
bannerGr.announcement = announcementGR.sys_id;
bannerGr.insert();


})(current, previous);​

Outcome

Once this rule is in place:

  • A UX banner Announcement will automatically appear for 10 minutes whenever an incident is created or updated to Priority 1 or Priority 2.

  • The Announcement includes a direct link to the incident and is visible only to specified users(based on roles) or groups.

  • This ensures quicker awareness and response from the support team, especially for time-sensitive issues.

saichary_0-1750667034644.png


Note

  • Ensure the system properties glide.uxbanner.group and glide.uxbanner.annoucement.config are configured with the correct group and banner configuration sys_ids.

  • This solution currently applies only to P1 and P2 incidents.

  • Duration can be adjusted by modifying the addSeconds(600) line in the script.

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Is it via Chatgpt?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hello Atul,


I wanted to clarify your comment.

The problem statement was received directly from our clients. Based on their inputs, we designed and implemented the solution internally. The functionality has been successfully delivered and accepted by the stakeholders.

Regarding the content and documentation, while I did use ChatGPT to assist in refining the phrasing and improving the clarity of the text. I believe there's no issue in using tools to enhance communication, as long as the core work is original and meets the client's expectations — which, in this case, it certainly does. To be honest, the way the question was raised didn’t feel appropriate.


Best regards,
Sai