Context from method to called email
- 5 years ago
I'm still open to other fixes to the above, but I ended up changing the email code (inside the if(checkIsRoot) above) to generate the email directly from the method instead of relying on a pre-defined email notification, and that has worked fine so far, allowing me to get the Part context:
Item iden = inn.getItemById("Identity", "097FB092EBDE42EB9E5A274ABC0059DA");
Item fromUser = inn.getItemById("User", "4B70708CE5B7410A9734505699CBFBAB");
string subject = "Part Promotion Notification";
string body = "<body><p>Hull BOM ${Item/item_number} has been released as Rev ${Item/major_rev}.</p>" +
"<p><a href=\"">localhost/.../ follow this link to view Part ${item_number}</a></p>" +
"</body>";
Item email_msg = this.newItem("EMail Message");
email_msg.setProperty("subject", subject);
email_msg.setProperty("body_html", body);
email_msg.setPropertyItem("from_user", fromUser);
if (this.email(email_msg, iden) == false)
{
return inn.newError("something went wrong");
}