Hi there
I have created a standard BPM on the QuoteHed table.
This BPM should send an email alert to designated people whenever the value on a UD flag field on the Quote Hed UD table is changed from 0 to 1 (any to another - condition 0)
If this is true then an email should be sent to myself - it is not working after amending the flag on the quote entry screen and saving it . I can see the value of the field is updating in the background SQL tables.
Any clues or suggestions as to why?
Thanks Dan… if I change to an in-trans directive I can get an information box to display when the change happens by using the show message object. However there is no send email option to add for this… How do I get the email to go from an in-trans directive?
Ok. There is no widget but you can generate it using Execute Custom Code widget. Here’s the important bits. Depending on what all you want to include, you can format it using HTML or just keep it plain.
var mailer = this.GetMailer(async:false);
var message = new Ice.Mail.SmtpMail();
message.SetFrom("Sender Name <sender@email.com>");
message.SetTo(fake@email.com);
message.SetBcc("another@email.com");
message.SetSubject("My subject");
message.SetBody("My body");
message.IsBodyHtml = true; //for a plain email change this to false
mailer.Send(message);
You can use both an in-tran and standard directive in unison. You can use the “Enable Standard Directive” widget in your in-trans directive, then in a standard directive, use the condition widget to check if “The directive has been enabled from the specified directive” to send your email.
I didn’t know this was a thing I could do. Is there a benefit to doing this vs. just running it as an In-Trans? I have a couple email notifications that I am running as an in-trans directive using the method I described above. When I originally did it, I tried to do it using a Standard directive but I ran into a similar issue as Andrew.
Since in-transaction directive’s MUST complete before the actual transaction will go through, doing everything in-trans could potentially delay/lag the actual transaction. Especially on a table like partTran or something. If you do it in a standard, the transaction will complete, and the user won’t have to wait for the BPM to finish before continuing what they were doing.
Thanks! I imagined this was the case. That’s one of the reasons why I picked Standard in the first place. I didn’t want the transaction to potentially be affected if there was an error in the BPM (which happens, by the way. An improperly typed email address on a customer record, for instance, will cause an error that stops the transaction). The ironic thing, though, is that it forces someone to fix the offending email address so the transaction can be completed. It turns out, this is a nice thing. But probably not very efficient. I may go back and update my BPM to do what you’ve mentioned. Thanks for teaching me something new!
Happy to help! I’ve run into this SAME thing before with email notifications, and thanks to this site I found this “best practice” with the 2 directives. Sure it will be “faster”, but depending on the scenario it may not necessarily be noticeably faster than just the in-trans.