- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2025 04:54 PM
If Incident Priority was p2 raised to P1
If Incident Priority was p3 raised to P1 or P2
If Incident Priority was p4 raised to P1/P2/P3
If Incident Priority was p5 raised to P1/P2/P3/P4
How do I achieve this using notification when to send Advanced scripting condition
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2025 07:46 PM
Navigate to System Notification > Email > Notifications.
When to send: Choose Updated
Use the Advanced condition to specify when the notification should be sent.
Use the below script.
If the conditions are met, it adds an informational message and returns true, triggering the notification.
// Check if the priority has changed
if (current.priority.changes()) {
// Check if the priority was raised from P2 to P1
if (current.priority == 1 && previous.priority == 2) {
gs.addInfoMessage('Incident priority raised from P2 to P1');
return true;
}
// Check if the priority was raised from P3 to P1 or P2
if ((current.priority == 1 || current.priority == 2) && previous.priority == 3) {
gs.addInfoMessage('Incident priority raised from P3 to P1 or P2');
return true;
}
// Check if the priority was raised from P4 to P1, P2, or P3
if ((current.priority == 1 || current.priority == 2 || current.priority == 3) && previous.priority == 4) {
gs.addInfoMessage('Incident priority raised from P4 to P1, P2, or P3');
return true;
}
// Check if the priority was raised from P5 to P1, P2, P3, or P4
if ((current.priority == 1 || current.priority == 2 || current.priority == 3 || current.priority == 4) && previous.priority == 5) {
gs.addInfoMessage('Incident priority raised from P5 to P1, P2, P3, or P4');
return true;
}
}
return false;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2025 08:40 PM
Hi @bgulshan
There's no need for an advanced scripting condition. You can simply define the conditions using the condition builder as shown below. This will fulfill your requirement.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2025 07:46 PM
Navigate to System Notification > Email > Notifications.
When to send: Choose Updated
Use the Advanced condition to specify when the notification should be sent.
Use the below script.
If the conditions are met, it adds an informational message and returns true, triggering the notification.
// Check if the priority has changed
if (current.priority.changes()) {
// Check if the priority was raised from P2 to P1
if (current.priority == 1 && previous.priority == 2) {
gs.addInfoMessage('Incident priority raised from P2 to P1');
return true;
}
// Check if the priority was raised from P3 to P1 or P2
if ((current.priority == 1 || current.priority == 2) && previous.priority == 3) {
gs.addInfoMessage('Incident priority raised from P3 to P1 or P2');
return true;
}
// Check if the priority was raised from P4 to P1, P2, or P3
if ((current.priority == 1 || current.priority == 2 || current.priority == 3) && previous.priority == 4) {
gs.addInfoMessage('Incident priority raised from P4 to P1, P2, or P3');
return true;
}
// Check if the priority was raised from P5 to P1, P2, P3, or P4
if ((current.priority == 1 || current.priority == 2 || current.priority == 3 || current.priority == 4) && previous.priority == 5) {
gs.addInfoMessage('Incident priority raised from P5 to P1, P2, P3, or P4');
return true;
}
}
return false;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2025 10:53 PM
In place of return true, using true and it is working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2025 08:40 PM
Hi @bgulshan
There's no need for an advanced scripting condition. You can simply define the conditions using the condition builder as shown below. This will fulfill your requirement.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2025 09:09 PM
Agreed! we can go with condition builder instead of advanced script, optimized for efficient execution, reducing the risk of performance issues.
If my response helped, please mark it correct and close the thread so that it benefits future readers.