Order Header BAM for POC Changes

The alert attachment template is something I played with enough to get working, but don't know much about.

I use the bam additional procedure a lot for alert emails.

I had one for orderrel and changed to orderHed. Save the code below with a p extension and put in the server\ud directory on your app server.

I have not run it, but it should be close. Errors and message lines will show in the app server log.

Good Luck.

Greg



{ud/GlbAlert.i &TableName = "OrderHed"}

assign SendEmail = false.


Define variable Planner as character no-undo.
define variable EmailAddress as Character no-undo initial '':U.
define variable UserName as Character no-undo initial '':U.

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 UserFile where UserFile.DCDUserID = DCD-UserID no-error.
assign EMAIL-From = UserFile.EmailAddress.


/* Create the new body of the email */



Assign vBody = "POC changed for " + string(OrderHed.OrderNum) + " by " + UserFile.Name +
"~n~n~tOrder Number: " + string(OrderHed.OrderNum) +
"~n~n~tOld POC " + OLDOrderHed.Character01 +
"~n~n~tNew POC " + OrderHed.Character01.


vTO = "email@..."
vCC = "you@...;". /* CC to check out alert */

/* Exampes of formatting and conditions */
/*
"~n~n~tMA Cost ~t" + string(Part.StdMaterialCost,"$>>>,>>>,>>9.99") + "~tExtended Cost " + trim(string(Part.StdMaterialCost * OrderHed.XOrderQty,"$>>>,>>>,>>9.99")) +
"~n~tPO Cost ~t" + string(OrderHed.UnitCost,"$>>>,>>>,>>9.99") + "~tExtended Cost " + TRIM(string(OrderHed.UnitCost * OrderHed.XOrderQty,"$>>>,>>>,>>9.99")) +


if (CostAtPO - CostAtStd) > 50 then do:
assign vTO = vTO + "info@...;".
end.

if (CostAtPO - CostAtStd) > 1000 then do:
assign vCC = vCC + "sales@...;".
end.
*/



Message "DEBUG Email - vTO = " + vTO.


EMAIL-To = vTO.
EMAIL-CC = vCC + EMAIL-From.
assign EMAIL-Subject = 'POC Changed on ' + OrderHed.OrderNum.
assign EMAIL-Text = vBody.


assign SendEmail = true.




From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of sanfranc415
Sent: Friday, May 24, 2013 11:25 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Order Header BAM for POC Changes



Okay, my BAM is working, but would like to include the Sales Order # that is part of a modification to the OrderHed.Character01. I've checked "included link" but my Alert Attachments Maintenance OrderHed template is blank.


________________________________
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-6280 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."


[Non-text portions of this message have been removed]
Okay, my BAM is working, but would like to include the Sales Order # that is part of a modification to the OrderHed.Character01. I've checked "included link" but my Alert Attachments Maintenance OrderHed template is blank.