E10 BPM Query Help

I am creating a BPM that I want to change the manifest info on an order when the ship to customer is changed. The issue I’m having is getting the ship to number I want to use in my ShipToMFBill table linking inside of the my BPM. The number I want is inside the Parameter ds inside of the BPM designer’s ‘Enter Custom Code’ screen. Basically I want to do what the code below is doing but I want to do with linking the ds.ShipToNum not the ttOrderHedRow.ShipToNum. I want to do this because i notice the BPM fires twice at times for the old and new shiptonum when they are being switched on an open order. However the ShipToNum i want is always the ShipToNum in the ds parameter, i just don’t know how to reference that in the BPM. Here is my current code:

Erp.Tables.OrderHed OrderHed;
Erp.Tables.ShipToMFBill ShipToMFBill;



foreach (var ttOrderHed_iterator in (from ttOrderHed_Row in ttOrderHed 
select ttOrderHed_Row))

{
	var ttOrderHedRow = ttOrderHed_iterator;
	foreach (var ShipToMFBill_iterator in (from ShipToMFBill_Row in Db.ShipToMFBill
																				where ShipToMFBill_Row.Company == ttOrderHedRow.Company &&
																				ShipToMFBill_Row.CustNum == ttOrderHedRow.ShipToCustNum &&
																				ShipToMFBill_Row.ShipToNum == ttOrderHedRow.ShipToNum
																				select ShipToMFBill_Row))

	{
		ShipToMFBill = ShipToMFBill_iterator;
		if(ShipToMFBill == null)
		{
			this.PublishInfoMessage("ShipToMFBill is null", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "BusinessObjectName", "MethodName");
		}
		if(ShipToMFBill != null)
		{

this.PublishInfoMessage("Not Null " + ttOrderHedRow.ShipToNum.ToString() , Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "BusinessObjectName", "MethodName");
			ttOrderHedRow["PayFlag"] = ShipToMFBill.PayBTFlag;
			ttOrderHedRow["PayAccount"] = ShipToMFBill.PayAccount;
			ttOrderHedRow["PayBTAddress1"] = ShipToMFBill.PayBTAddress1;
			ttOrderHedRow["PayBTAddress2"] = ShipToMFBill.PayBTAddress2;
			ttOrderHedRow["PayBTAddress3"] = ShipToMFBill.PayBTAddress3;
			ttOrderHedRow["PayBTCity"] = ShipToMFBill.PayBTCity;
			ttOrderHedRow["PayBTState"] = ShipToMFBill.PayBTState;
			ttOrderHedRow["PayBTZip"] = ShipToMFBill.PayBTZip;
			ttOrderHedRow["PayBTCountry"] = ShipToMFBill.PayBTCountry;
			ttOrderHedRow["PayBTPhone"] = ShipToMFBill.PayBTPhone;
		}

		
	}
}

I think I am following you. You are already referencing the ds.ShipToNum by using ShipToNum in ttOrderHed. You will see one row with an empty RowMod “” that contains the before value and then another row with a RowMod of “U” with the new value. You can use RowMod to get the value you want to use.

1 Like