E10.1 Generate and send PO approval message to POApvMsg from BPM method directive?

I’m implementing a PO limit that works differently than the standard operation. It’s done in a post directive on ChangedApproveSwitch. If the directive decides the PO needs approval I need for it to create the approval message in the table POApvMsg.

Has anyone here done something like that?



We’ve not done POs but we have done BPMs on Requisitions. However, we did it on Req.Update method and had the logic in the BPM to determine if (condition widget) and whom to email. C# code block to fill in the Name, Email Addr, and other variables then the email widget to send the message.

Would you not want to do that on a Pre vs. Post since it sounds like you have custom approval logic? I have done a few similar projects using this method.

Did you write the code or convert from ABL for this? I’m having a heck of a time getting my converted ABL code to pull the email from the UserFile table. New to the C# part and currently moving from 9.05 to 10.2.

Ours is on OrderHed to send the OrderAck ask a PDF file using SSRS there is a thread on here about it. I used the “Set Argument/Variable” nodes (or whatever the term is) to set a BPM variable with a simple C# code:
Db.UserFile.FirstOrDefault(uf => uf.DcdUserID == ttOrderHedRow.EntryPerson).EMailAddress ?? ""

1 Like

var PurAgentRow = (from row in Db.PurAgent where row.BuyerID == buyerid && ttPOApvMsgRow.Company.Equals(row.Company, StringComparison.OrdinalIgnoreCase)

select row).FirstOrDefault(); Is what I use for the PO Notices I send out. Buyers have a separate setup than users.

I use the something similar for PO approval actions. My issue is with purchase requisition module. I’m using the ReqHead.CurrentDispatcherId for the person to notify when they have something to approve, StatusType = “P”. (they never check thier ques) I was getting the email address from Userfile in ABL. My new code looks similar to Randy’s example but it’s not quite there yet.

string vapprov = string.Empty;
Erp.Tables.UserFile UserFile;
foreach (var ttReqHead_iterator in (from ttReqHead_Row in ttReqHead
where ttReqHead_Row.ReqNum != 0 && ttReqHead_Row.CurrDispatcherID != null
select ttReqHead_Row))
var ttReqHeadRow = ttReqHead_iterator;
UserFile = (from UserFile_Row in Db.UserFile
where string.Compare(UserFile_Row.DcdUserID, ttReqHeadRow.CurrDispatcherID, true) == 0
select UserFile_Row).FirstOrDefault();

vapprov = UserFile.EMailAddress;
 if (!String.IsNullOrEmpty(vapprov))

string vFrom = string.Empty;
string vTo = string.Empty;
string vCC = string.Empty;
string vSubject = string.Empty;
string vBody = string.Empty;
vFrom = "admin@admin.com";
vTo = vapprov;
vCC = “”;
vSubject = vSubject + “Requistion Number " +
System.Convert.ToString (ttReqHeadRow.ReqNum)+ " needs approval”;
vBody = vBody + “The above Requistion number requires approval in Epicor.”;
var mailer = this.GetMailer(async: false);
var message = new Ice.Mail.SmtpMail();