BPM Code Check

Trying to send an email if Checkbox is true and then depending on plant…set the To

define variable body     as character no-undo.
 define variable vFrom    as character no-undo.
 define variable vTo      as character no-undo.
 define variable vCC      as character no-undo.
 define variable vSubject as character no-undo.
 define variable vBody    as character no-undo.
 define variable hEmailEx  as handle no-undo.

 run Bpm/BpmEmail.p persistent set hEmailEx.

 vFrom = "Epicor9@CCICMS.COM".


 for each ttrcvdtl where (ttrcvdtl.RowMod = 'U' or ttrcvdtl.RowMod = 'A') and ttrcvdtl.Received = yes and ttrcvdtl.InspectionReq = yes, each porel where (porel.Company = ttrcvdtl.Company and porel.PONum = ttrcvdtl.PONum and porel.POLine = ttrcvdtl.POLine and porel.PORelNum = ttrcvdtl.PORelNum) no-lock:
 	
 		IF porel.CheckBox01 = true THEN 
 				assign vSubject = 'ALERT: Inspection Required on Material Received - HOT SHORTAGE. - ' + ttrcvdtl.Plant.
 			ELSE
 				assign vSubject = 'Inspection Required on Material Received - ' + ttrcvdtl.Plant.
 					
 			IF porel.Plant = 'MfgSys' THEN  assign vTo = "Email1@ccicms.com". ELSE
 			IF porel.Plant = 'CIS' THEN  assign vTo = "Email2@ccicms.com". ELSE
 			IF porel.Plant = 'DEM' THEN 	assign vTo = "Email3@ccicms.com". ELSE
 			IF porel.Plant = 'NWO' THEN 	assign vTo = "Email4@ccicms.com". ELSE
 			IF porel.PLant='GDL' THEN 	assign vTo = "Email5@ccicms.com". 
 	
 		vBody = 'The following material was received under PO / Line /Rel ~r' + string(ttrcvdtl.PONum) + '/' + string(ttrcvdtl.POLine) + '/' + string(ttrcvdtl.PORelNum) + '~rPN: ' + ttrcvdtl.PartNum + '~rDesc: ' + ttrcvdtl.PartDescription + '~rQty: ' + string(ttrcvdtl.VendorQty) + "~r~rBPM.Reciept.Update.Pre.50 - MAS".

   	run SendEmail in hEmailEx (false,ttrcvdtl.company,vFrom,vTo,vCC,vSubject,vBody,"").

 end.

Can’t you use Auto print? It’s a standard directive and can easily be configured.

Rebecca

That’s Epicor 9. What is it that you need; converting it to Epicor 10 help or ?