I have been doing simple Data Directives up until now, but need to expand some with C#
I don’t have much clue in C# but this is what I need to achieve
From a Standard Data Directive, I need to be able send off an email to the Sales Rep
The trigger to send the email is based on a condition in the OrderHed,
The only field available in the OrderHed related to the sales rep is SalesRepList which contains a list of sales rep numbers related to the sales order, all our sales orders only have one sales rep so that part is fine, what I need to be able to do is look up the SalesRep table, match the sales rep number and return the email address and name
If the values of the field OrderHed.SalesRepList are equals to the value of SalesRep.SalesRepCode you can try below code using the Execute Custom Code function.
First assigned or set the callContextBpmData.Character01 to ttOrderHedRow.SalesRepList using Set BPM Data Field.
var SysSalesRep = (from SysSalesRep_Row in Db.SalesRep
where SysSalesRep_Row.Company == Session.CompanyID
&& SysSalesRep_Row.SalesRepCode == callContextBpmData.Character01