Need help on trigger notification based on RITM Priority

Lisa Goldman
Kilo Sage

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:

 

LisaGoldman_0-1702502658371.png

 

10 REPLIES 10

SanjivMeher
Kilo Patron
Kilo Patron

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.


Please mark this response as correct or helpful if it assisted you with your question.

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?

Tai Vu
Kilo Patron
Kilo Patron

Hi @Lisa Goldman 

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.

Screenshot 2023-12-14 at 10.38.35.png

(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