Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Business rule to prevent emails sending to system users

georgechen
Kilo Guru

Hi folks,

I am trying to brainstorm the idea of creating a new business rule on sys_email table before condition, but wonder if anyone has thought of the similar idea.

Name: (Test) Prevent emails sent to users with conditions

Table: Email [sys_email]

Active: True

Condition:   !current.instance.nil() && current.type=='send-ready' && current.weight > '0'

Script:  

preventSendingEmails();

function preventSendingEmails() {

/*   some conditions checking

      Checking 1:   Email contains NOADDRESS

      Checking 2:   Email contains DUPLICATE

      Checking 3:   Email notification = 1 (None)

*/

current.type = 'send-ignored';

}

Any input would be appreciated

5 REPLIES 5

Thank you!! That worked brilliantly. Totally saved my butt for a meeting today to discuss this problem.