Email notification should not triggered when the incident record is created with the state of closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2025 03:20 AM
Hi every one,
I have one issues, when the incident record is created with the state of closed then the email notification should not triggered, but it's should trigger when the state is changed to one state to other.so i have created the event registry added into this BR and trigger this into the notification, how can i add the condition
1.when the SIR Created with the state of closed then notification should not trigger
2.When the SIR Created the Draft state then the state is changes from one state to closed the notification should be triggered,
BR condition,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2025 03:42 AM
why not update the BR condition appropriately?
BR is on which table and share configuration screenshots of that BR
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2025 04:19 AM
you can separate out the event trigger logic in 2 different BR
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2025 03:54 AM
Hi Deepika,
Personally, I feel that a Flow Designer approach might be better for implementing the above situation, as it provides a more intuitive and maintainable way to handle such conditions. However, if you're sticking with a Business Rule, you can try modifying the script as follows:
(function executeRule(current, previous /*null when async*/) {
// Check if the state is 'Closed' when the record is created
if (current.isNewRecord() && current.state == 'Closed') {
return; // Exit without triggering the event
}
// Check if the state has changed from any value to 'Closed'
if (!current.isNewRecord() && current.state.changesTo('Closed')) {
gs.eventQueue('sir.state.changed.to.closed', current, current.assigned_to, current.assignment_group);
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2025 06:51 AM
I have tried the above one it's not working, email not triggered all the scenario.