Here is an example I’ve built onto POApvMsg.
Please ignore the first condition as it just ignores a certain group.
Erp.Tables.PurAgent PurAgent;
Erp.Tables.POHeader POHeader;
Erp.Tables.Vendor Vendor;
var ttPOApvMsg_xRow=(from ttPOApvMsg_Row in ttPOApvMsg
where string.Compare(ttPOApvMsg_Row.RowMod ,“U” ,true)==0|| string.Compare(ttPOApvMsg_Row.RowMod ,“A”
,true)==0 select ttPOApvMsg_Row).FirstOrDefault();
string AppPerson = string.Empty;
string VendorName = string.Empty;
int VendorNum = 0;
string EntryPerson = string.Empty;
if(ttPOApvMsg_xRow != null)
{
PurAgent =(from PurAgent_Row in Db.PurAgent
where PurAgent_Row.Company == Session.CompanyID && string.Compare(PurAgent_Row.BuyerID,ttPOApvMsg_xRow.MsgTo,true)== 0
select PurAgent_Row).FirstOrDefault();AppPerson = PurAgent.EMailAddress; POHeader =(from POHeader_Row in Db.POHeader where POHeader_Row.Company == Session.CompanyID && POHeader_Row.PONum == ttPOApvMsg_xRow.PONum select POHeader_Row).FirstOrDefault(); VendorNum = POHeader.VendorNum; Vendor =(from Vendor_Row in Db.Vendor where Vendor_Row.Company == Session.CompanyID && Vendor_Row.VendorNum == VendorNum select Vendor_Row).FirstOrDefault(); VendorName = Vendor.Name; EntryPerson = POHeader.EntryPerson; if(PurAgent != null && POHeader != null){ callContextBpmData.Character01 = AppPerson; callContextBpmData.Character02 = VendorName; callContextBpmData.Character03 = EntryPerson; } }
We have messages sending to the original user when the PO gets its final approval. It uses the same custom code but with the condition being “2” instead of “1”