Just another take on how to do this, we only used C# code for looking up the Purchase Agent’s email addresses and assigning it to a BPM context for use later This is a standard Data Directive on the POApvMsg table:
Erp.Tables.PurAgent PurAgent;
foreach (var ttPOApvMsg_iterator in (from ttPOApvMsg_Row in ttPOApvMsg
where string.Equals(ttPOApvMsg_Row.RowMod, IceRow.ROWSTATE_ADDED, StringComparison.OrdinalIgnoreCase) || string.Equals(ttPOApvMsg_Row.RowMod, IceRow.ROWSTATE_UPDATED, StringComparison.OrdinalIgnoreCase)
select ttPOApvMsg_Row))
{
var ttPOApvMsgRow = ttPOApvMsg_iterator;
foreach (var PurAgent_iterator in (from PurAgent_Row in Db.PurAgent
where string.Compare(PurAgent_Row.Company, ttPOApvMsgRow.Company, true) == 0
&& string.Compare(PurAgent_Row.BuyerID, ttPOApvMsgRow.MsgTo, true) == 0
select PurAgent_Row))
{
PurAgent = PurAgent_iterator;
callContextBpmData.ShortChar01 = PurAgent.EMailAddress;
}
foreach (var PurAgent_iterator in (from PurAgent_Row in Db.PurAgent
where string.Compare(PurAgent_Row.Company, ttPOApvMsgRow.Company, true) == 0
&& string.Compare(PurAgent_Row.BuyerID, ttPOApvMsgRow.MsgFrom, true) == 0
select PurAgent_Row))
{
PurAgent = PurAgent_iterator;
callContextBpmData.ShortChar02 = PurAgent.EMailAddress;
}
}