Hi all,
I’m currently working on a BPM (data directive standard) on InvcHead. When an invoice group is printed (printchecked flag is true), it checks if a customer contact with defined role code (in my case use “INVNT” value) and valid email address exists.
My problem is my code and directive only works on an invoice group with 1 invoice only. If the invoice group contains multiple invoices then it’s not going to run.
Any suggestions on how to loop through all the invoice numbers as needed? Not really having a coding background so it sounds a little bit tricky for me.
Erp.Tables.CustCnt CustCnt;
Erp.Tables.Customer Customer;
foreach (var ttInvcHead_iterator in (from ttInvcHead_Row in ttInvcHead
select ttInvcHead_Row))
{
var ttInvcHeadRow = ttInvcHead_iterator;
foreach (var Customer_iterator in (from Customer_Row in Db.Customer
where string.Compare(Customer_Row.Company, ttInvcHeadRow.Company, true) == 0
&& Customer_Row.CustNum == ttInvcHeadRow.CustNum
select Customer_Row))
{
Customer = Customer_iterator;
callContextBpmData.ShortChar01 = Customer.CustID;
callContextBpmData.Character02 = Customer.Name;
foreach (var CustCnt_iterator in (from CustCnt_Row in Db.CustCnt
where string.Compare(CustCnt_Row.Company, ttInvcHeadRow.Company, true) == 0
&& CustCnt_Row.CustNum == ttInvcHeadRow.CustNum && CustCnt_Row.RoleCode == “INVNT”
select CustCnt_Row))
{
CustCnt = CustCnt_iterator;
callContextBpmData.Character01 = CustCnt.EMailAddress;
}
}
}
Thanks,
Harry