I’m kind of new to Epicor. and I have been asked to UPDATE the header of the order to populate the number of boxes in an order. I have the following function that get call in a the Post Method Directive “MasterUpdate”. I have tried different things such as an update the table itselt (DB.Orderhed). but that id not work out. Lately I have tried to call the MasterUpdate method one more time in my BPM but I think I’m missing something. Would you be so kind and review my code to explain me why it does not update. Or tell me how can do update 4 fields that exist in the orderhed this update must be on a Post Method Directive. Thanks in advance for the guidance…
Action<int,int, decimal, decimal,decimal, bool, bool > UpdateGroundInfoNewVersion = (inOrderNumber, inCustNum, inTotalWeight, inTotalBoxes, inTotalPallets, inCheckBox19, inCheckBox20) =>
{
using (var txScope = IceContext.CreateDefaultTransactionScope())
{
using (var SalesOrderSvc1 = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db))
{
var SOds = SalesOrderSvc1.GetByID(inOrderNumber);
string outStringOne = "" ;
string outStringTwo = "" ;
string outStringThree = "" ;
string outStringFour = "" ;
string outStringFive ;
string outStringSix = "" ;
bool outStrinBoolOutput = false;
for (int i = 0; i < SOds.OrderHed.Count; i++)
{
this.PublishInfoMessage("SOds.OrderHed[i].OrderNum " + SOds.OrderHed[i].OrderNum + "CustNum = " + inCustNum.ToString(), Ice.Common.BusinessObjectMessageType.Information,Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
SOds.OrderHed[i].OrderComment = "Test";
SOds.OrderHed[i].RowMod = "U";
SOds.OrderHed[i]["Number16"] = inTotalWeight;
//this.PublishInfoMessage("Number16 " + SOds.OrderHed[i]["Number16"].ToString() , Ice.Common.BusinessObjectMessageType.Information,Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
}
SalesOrderSvc1.MasterUpdate(true, true, "OrderHed", inCustNum, inOrderNumber, true, out outStrinBoolOutput, out outStringOne , out outStringTwo, out outStringThree , out outStringFour , out outStringFive , out outStringSix, ref SOds);
this.dsHolder.Attach(SOds);
}
} ///
//using (var SalesOrderSvc1 = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db))
//{
//var SalesOrderDs1 = SalesOrderSvc1.GetByID(inOrderNumber);
//this.dsHolder.Attach(SalesOrderDs1);
//}
};