Customizing Approval Notifications for a Catalog Item

DevtoSME
Giga Guru

I’m working on a custom catalog item where a variable is intended to be populated on the Cat.Task, and then copied to the work notes of the RITM. The goal is to include this variable value in the approval notification that goes out to a user or group.

However, the platform is still triggering the OOB approval notification tied to the request.approval.inserted event.

 

What is the recommended to stop the OOB notification  for just this cat item? or can I use a script to exculde my cat item from the OOB notification. i tried a BR and the event is still triggering before mine. 

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@DevtoSME 

you will have to separate it out

1) create a custom notification on Approval insertion and ensure it works only for your catalog item, use advanced notification condition for this and then use email script to print the variable you want

I hope you know how this can be done.

Query RITM table with current.sysapproval and check the catalog item name and set answer=true if it's your item

		var rec = new GlideRecord('sc_req_item');
		rec.addQuery('sys_id', current.sysapproval);
		rec.addQuery('cat_item.name', 'Your Item Name');
		rec.query();
		answer = rec.hasNext(); // trigger for your item only

2) update the existing OOTB approval notification using advanced notification condition so that it doesn't trigger for your catalog items but works for other items

		var rec = new GlideRecord('sc_req_item');
		rec.addQuery('sys_id', current.sysapproval);
		rec.addQuery('cat_item.name', 'Your Item Name');
		rec.query();
		answer = !rec.hasNext(); // don't trigger OOTB if it's your item

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@DevtoSME 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@DevtoSME 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader