How to exclude recipients in a notification using email script?

Aditya Sinha
Tera Contributor

I have 2 notifications-one on request table [A] and one on request item table [B] which trigger when a catalog item Z is requested. The cat item has a field named company . If the value of the company is X,  then the emails should not go to the requested for. How can I achieve this using an email script or otherwise?

2 REPLIES 2

Shraddha Kadam
Mega Sage

Hello @Aditya Sinha,

 

Do not add Requested for in the who will receive section.

 

Please mark my answer helpful and hit the thumb button.

 

Thank you.

If my response was helpful, please mark it as correct and helpful.
Thank you.

Hajar BENJAHHAR
Mega Sage

Hello @Aditya Sinha

 

If the second notification is triggered only for a specifi catalog item, you can build your condition as shown in this screenshot. Additionally, don't forget to create a property that stores the sys_id of the company 

Capture d'écran 2024-08-30 203502.png

 

However, if your notification is used by other catalog items, you'll need to script your condition. In the script, verify if the sys_id of the catalog item is the same as  the sys_id stored in the property you created earlier, and also confirm the company.

 

answer = true;

if(current.variables.name_of_your_variable==gs.getProperty('company') && current.item==gs.getProperty('item')){
	answer = false;

}

 

I hope you find this helpful!

 

Best regards, 

Hajar