Im working on building a BPM for Po approvals when there is more than 1 level of approvals. i already have a BPM set up for the first level.
I am building it on the POApvMsg Table when the MsgTo field is changed and the MsgType is ‘1’
my issue is getting the Email address from the PurAgent table associated with the buyer ID in the MsgTo field.
Below is something similiar to code provide by a peer on spiceworks that i changed the tables, but i am new to C# and need help…
Are you using Method or Data directive? I had gotten some help form here before with the code and set it up using Data Directive. I just emailed Stephen :)
//Get Temp Record
var ttPOApvMsg_xRow = ttPOApvMsg.FirstOrDefault();
// Get Buyer of MsgTo on Temp Record
var PurAgent = Db.PurAgent.FirstOrDefault(y => y.BuyerID == ttPOApvMsg_xRow.MsgTo);
BpmContext.BpmData["Character01"] = PurAgent.EMailAddress;
BUT to further improve this, since you only want ONE FIELD from each of those queries, you should tell sql to only return the needed field, and not then entire row. (Changes highlighted below)… it could be further improved by making the two queries into one joined query.
Can you share the BPM workflow setup, we pasted the code into our Custom Code but it does not work, no email notifications are going out. we have the standard directive setup for notifying the buyer on the PO of approval or rejection status but the Approval Person needed is not receiving the emails. ?