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;
.
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.
Any Help would be appreciated!