Need to trigger an email when work note changes and the work note is not added by the Assigned to
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Have a requirement in incident table ; to trigger an email when work notes is added on the record and it's not added by the assigned to user.
Approach I tried :
1. Created an event
2. Create a Business Rule with below code :
When to run : After
Insert : true
Update : true
Conditions : work note CHANGES and assigned to is not EMPTY.
Order: 2,000
(function executeRule(current, previous) {
gs.info("sreesh :: complaints :: BR triggered :: " + current.number);
// Only trigger event if the user changing the work notes is NOT the assignee
if (gs.getUserID() != current.assigned_to.toString()) {
gs.info("sreesh :: complaints :: Firing event :: updated by " + gs.getUserDisplayName());
gs.eventQueue('workNoteUpdated', current, current.assigned_to, current.work_notes.getJournalEntry(1));
} else {
gs.info("sreesh :: complaints :: Updated BY assignee → no notification triggered.");
}
})();
Seems like my Business Rule is not triggering. Any help on this would be helpful 🙂
Regards,
Sreesh Surendran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
you are not seeing the log inside the IF condition?
Script looks fine to me
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
