Using the BR, displays an info message showing today's date when Incident is created critical
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 10:03 PM
Hi,
Using the BR, displays an info message showing today's date when an Incident is created with a priority set to "Critical."
Please hele me out with BR.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2025 10:39 PM
Hello @kranthi2
Under Advanced section tab under script field enter below code:
(function executeRule(current, previous /*null when async*/) {
// Get today's date
var today = new GlideDateTime();
// Display an info message with today's date
gs.addInfoMessage('Incident created with Critical priority on: ' + today.getDisplayValue());
})(current, previous);
Your output will be as below:
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 02:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 06:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2025 03:31 AM
Hello @kranthi2
To create a Business Rule that displays an info message showing today's date when an Incident is created with a priority set to "Critical," follow these steps:
Configuration:
- Name: Display Today's Date on Critical Priority Incident
- Table: Incident
- When: After Insert
- Condition: priority is critical (assuming "1" represents "Critical" priority)
- Script:
(function executeRule(current, previous /*null when async*/) {
// Get today's date in the desired format
var today = new GlideDateTime();
var formattedDate = today.getLocalDate().toString(); // Formats it as 'yyyy-MM-dd'
// Display an info message with today's date
gs.addInfoMessage("Incident created with Critical priority. Today's date is: " + formattedDate);
})(current, previous);
- This Business Rule triggers if the Incident's priority is set to "Critical"
- It uses GlideDateTime to fetch the current date and formats it.
- The gs.addInfoMessage() function is used to display an info message with today's date in the Incident form.
Once the Incident is created with the Critical priority, the info message will display on the Incident record showing the current date.
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar