How do I check to see if an In-Process Data Data Directive Fired?

I had an In-Process Data Directive working in our Pilot DB that would fire if a ttJobHead.JobReleased filed was change from False to True. Then Condition 2 would check to see if and of the Operations on that Job began with the letters CHM


then using a custom code block that I copied from another post on this forum:


//Send Email after
// Initialize Actions
Func<string, string> GetCompanyAddressAction = (CompanyID) => {

  var Company_Row =
    (from sc in Db.SysCompany.With(LockHint.NoLock)
    where sc.Company == CompanyID
    select new { sc.EmailFromAddr, sc.EmailFromLabel }).FirstOrDefault();

  if (Company_Row != null) {
    return string.Format(@"""{0}"" <{1}>", Company_Row.EmailFromLabel.Trim(), Company_Row.EmailFromAddr.Trim());
  }

  return string.Empty;
};

// Initialize Mail Variables
string EmailTO = "mike.ruoppoli@distran.com";
//string EmailTO = "youcanAddMultiples@cc.me; orccMe@whitehouse.org";
string EmailCC = "";
string EmailBCC = ""; // If blank itll be just ignored on bottom
string EmailSubject = "";
string EmailBody = "";

// Get JobHead
var ttJobHead_Row = ttJobHead.FirstOrDefault();

if (ttJobHead_Row != null)
{

  // Set Subject
  EmailSubject = "Chemthane Paint Job #: " + ttJobHead_Row.JobNum + " Released in Company " + ttJobHead_Row.Company;

  // Start Email Body
  EmailBody += string.Format("Job # <b>{0}</b> was released on <b>{1}</b> and has <b>{2}</b>-Chemthane Painted Poles that have an Estimated Shipdate of <b>{3}</b>.",ttJobHead_Row.JobNum, DateTime.Today.ToString("d"),(int)ttJobHead_Row.ProdQty, ttJobHead_Row.ReqDueDate.Value.ToString("d"));

    EmailBody += "<BR><BR>";


    // Send Email
  var mailer = this.GetMailer(async:true);
  var message = new Ice.Mail.SmtpMail();
  message.SetFrom( GetCompanyAddressAction(ttJobHead_Row.Company) );
  message.SetTo(EmailTO);
  message.SetCC(EmailCC);
  message.SetBcc(EmailBCC);
  message.SetSubject(EmailSubject);
  message.SetBody(EmailBody);
  message.IsBodyHtml = true;
  mailer.Send(message);

  //Ice.Diagnostics.Log.WriteEntry(" Chemthane Pole - Email Sent!");
  }

This fired in Pilot back on Feb 4th several times and sent the following email as the final version.

Something has changed and I can’t get it to work anymore. I checked with our IT about any changes to Exchange Server. The Server name did change since then but jives with the server name in the Company Configuration;
image.

Does this line in the Code var mailer = this.GetMailer(async:true); , have anything to do with
the Action in the Execute Custom Code 3 as “Synchronously”?

Not sure what else to try to see if this is firing when the JobReleased checkbox is set.
image

Any Help would be appreciated!

Put a message box in the DD to pop up with some indicator of where it came from. Then transact and wait to see if it appears.

Like this?

Yes. You can even put one off of the conditions for false in case the condition is failing when it should not be.

@jkane

The Show message did not pop up but the exception did so i just moved it around to find the problem. It was the Code had async = true and did not match. Changed them both to Sync (async = false;) and it worked.

Thanks for the help! have a good weekend

1 Like

Page 116 in the Epicor Performance Tuning Guide (10.2.500) says:

Avoid creating Business Process Management (BPM) methods that generate email messages synchronously. When you generate email through this BPM option, each email needs to be sent before other functions can run. If these synchronous methods run frequently, performance is reduced. Instead, set up BPM methods to send email asynchronously. Other functions can then run while the email is in the system queue.