From an email script can you abort an email?

e_wilber
Tera Guru

I have some complex logic in an email script for one of my email notifications. If there a way, from the email script, to abort the email from sending?

4 REPLIES 4

dvp
Mega Sage
Mega Sage

I'm not sure about the email script but you can restrict using advanced condition field on notification


find_real_file.png


Matthew Glenn
Kilo Sage

My very dirty solution to this was, in my notification script, when I hit a point where I knew I needed to abort the message, I wrote out a very unique string to the message body. Then, I had a business rule on sys_email that looked for and dropped messages with that string before they were sent.



Dirty and a horrible practice, yes.


Effective, yes, as well.


James Michaels1
Giga Expert

Depending on what your logic is you might be able to change the notification to be event triggered and then do your testing in a business rule. Depending on what kind of data you need you might be able to offload everything but the template.print to the business rule. That would make it easier to abort but might not allow you to do what you are trying.


venkatiyer1
Giga Guru

Hi Eric,



Either you have to use Advanced Script as dvp suggested or you have to got to use business rule in sys_email to stop it as Mathew suggested.



To add to what Mathew suggested you could use the email (Emailoutbound object) to set the subject to an unique string and use a business rule on sys_email to abort further action.



email.setSubject("")



Mail script API