Need help on trigger notification based on RITM Priority
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 01:29 PM
Hello,
We need help on trigger an email notification on "sysapproval_approver" table when RITM Priority is "High" or changed to "High" priority. Please help. Thank you
Example of existing RITM record:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 01:39 PM
You can create a Business rule when there is a change in Priority and then query all the approval record and trigger event for each of them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 03:01 PM
Hi @SanjivMeher
Thank you for your suggestion. I really need help on the scripting, because I'm still learning. Do you have an example where I can use it as a guide?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 03:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 07:41 PM
You can define an Event in the Event Registry [sysevent_register] table.
Then create new Business Rule in the Requested Item [sc_req_item] table. After triggering, you can query to collect all the approvers as the recipients, and fire the event to trigger the Notification.
Sample below.
(function executeRule(current, previous /*null when async*/) {
var recipients = [];
var grApproval = new GlideRecord('sysapproval_approver');
grApproval.addQuery('sysapproval', current.getUniqueValue());
grApproval.query();
while(grApproval.next()){
recipients.push(grApproval.getValue('approver'));
}
gs.eventQueue('<your_event_name>', current, recipients.join(','), '');
})(current, previous);
Cheers,
Tai Vu