I am on Epicor 9.05.702A Progress. I was asked to create a BPM that would send an email if a jobhead date01 field gets updated to a date greater than the date that it was previously set at. The email needs to have the before and after fields data information. It sounded easy enough but I couldn't find what I would call a "simple" way to do this and I think I made it way too clunky.
I did this in 2 parts by first creating a pre-processing method directive BMP on job entry on the condition that date01 changed and then the action used simple code to set date20 to the orig date01.
before and after is easiest for me in a BAM. you can reference the original data with OLDJobHead.date01. You can use a rule in the bam setup or have a condition that sets SendEmail = false if you don’t want the email sent.
Below is a sample on credit changing.
Greg
{ud/GlbAlert.i &TableName = "Customer"}
ASSIGN SendEmail = FALSE.
/* format Email Text */
define variable EmailAddress as Character no-undo initial '':U.
define variable UserName as Character no-undo initial '':U.
define variable OldTerm_Description as Character no-undo initial '':U.
define variable Tot_Invoices as decimal no-undo initial 0.
define variable vFrom as character no-undo initial '':U.
define variable vTo as character no-undo initial '':U.
define variable vCC as character no-undo initial '':U.
define variable vSubject as character no-undo initial '':U.
define variable vBody as character no-undo initial '':U.
Find First UserFile where UserFile.DCDUserID = DCD-UserID no-error.
Find First Terms where OldCustomer.TermsCode = Terms.TermsCode and Terms.Company = Customer.Company.
If Available Terms then
OldTerm_Description = Terms.Description.
Find First Terms where Customer.TermsCode = Terms.TermsCode and Terms.Company = Customer.Company.
For Each InvcHead where InvcHead.CustNum = Customer.CustNum and InvcHead.Company = Customer.Company and InvcHead.OpenInvoice = yes.
Tot_Invoices = Tot_Invoices + InvcHead.InvoiceAmt.
End.
Assign vBody =
"~n~n~tA Change in Territory, Terms code or credit limit has been made by " + UserFile.Name +
"~n~n~tCustomer " + Customer.CustID +
"~n~n~tName " + Customer.Name.
If Customer.TerritoryID <> OLDCustomer.TerritoryID Then Do.
vBody = vBody + "~n~n~tOld Territory " + OLDCustomer.TerritoryID +
"~n~n~tNew Territory " + Customer.TerritoryID.
End.
vBody = vBody + "~n~tTotal Invoices:" + string(Tot_Invoices,"$>>>,>>>,>>9.99").
IF Customer.CreditLimit <> OldCustomer.CreditLimit Then Do:
vBody = vBody + "~n~n~tOld Credit Limit:" + string(OldCustomer.CreditLimit,"$>>>,>>>,>>9") +
"~n~n~tNew Credit Limit:" + string(Customer.CreditLimit,"$>>>,>>>,>>9").
End.
Else do:
vBody = vBody + "~n~n~tCredit Limit:" + string(Customer.CreditLimit,"$>>>,>>>,>>9").
End.
If Customer.TermsCode <> OldCustomer.TermsCode then do:
vBody = vBody +
"~n~n~tOld Terms " + OldTerm_Description +
"~n~n~tNew Terms " + Terms.Description.
End.
Else Do:
vBody = vBody +
"~n~n~tTerms " + Terms.Description.
End.
assign vTO = "user@...;user@..."
vCC = "info@...".
assign EMAIL-From = UserFile.EmailAddress.
EMAIL-To = vTO.
EMAIL-CC = vCC + ";" + EMAIL-From.
assign EMAIL-Subject = 'Terr/Terms/Credit Changed on ' + Customer.CustID + " - " + Customer.Name.
If Length (EMAIL-Subject) > 60 Then EMAIL-Subject = substring(EMAIL-Subject,1,60).
assign EMAIL-Text = vBody.
assign SendEmail = true.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, January 27, 2016 11:27 AM
To: Vantage List
Subject: [Vantage] 9.05.702A Progress - BPM Feedback/Advice
I am on Epicor 9.05.702A Progress. I was asked to create a BPM that would send an email if a jobhead date01 field gets updated to a date greater than the date that it was previously set at. The email needs to have the before and after fields data information. It sounded easy enough but I couldn't find what I would call a "simple" way to do this and I think I made it way too clunky.
I did this in 2 parts by first creating a pre-processing method directive BMP on job entry on the condition that date01 changed and then the action used simple code to set date20 to the orig date01.
And then step 2 was to create a standard data directive on the jobhead table with the condition date01 > date20 and the action to send the email.
This does work correctly and accomplishes what I need. But I am sure there is a simpler way of doing this (that also wouldn't require using a date field to hold the orig data), so I am just looking for any feedback on what other users do to accomplish this.
CONFIDENTIALITY NOTICE
The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at 727-578-6240 and immediately delete the communication.
"This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."