It returns the ShipToList
yes. Which is the ShipToID and Name.
This really does sound like a One Time Ship To situation, if you donât want the address saved disable the checkbox to save the one time ship to.
I now changed direction and I am trying to used Method Directive Sales Order MasterUpdate to reuse a ShipTo record instead of creating multiple Ship To records. I am able update the Ship To fields except for the CountryNum field. I keep getting an error when trying to update this field.
Error:BPM runtime caught an unexpected exception of âNullReferenceExceptionâ type.
See more info in the Inner Exception section of Exception Details.
Code:
var ttOrderHed_xRow = (from ttOrderHed_Row in ttOrderHed
where ttOrderHed_Row.Company == CompanyID
&& (string.Equals(ttOrderHed_Row.RowMod, IceRow.ROWSTATE_ADDED, StringComparison.OrdinalIgnoreCase) || string.Equals(ttOrderHed_Row.RowMod, IceRow.ROWSTATE_UPDATED, StringComparison.OrdinalIgnoreCase))
select ttOrderHed_Row).FirstOrDefault();
if(ttOrderHed_xRow != null)
{
var Customer_xRow = (from Customer_Row in Db.Customer
where Customer_Row.Company == CompanyID
&& Customer_Row.CustNum == ttOrderHed_xRow.CustNum
select Customer_Row).FirstOrDefault();
PublishInfoMessage("Customer.CustNum: " + Customer_xRow.CustNum.ToString(), Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "MasterUpdate", "Customer");
if(Customer_xRow != null)
{
var ShipTo_xRow = (from ShipTo_Row in Db.ShipTo
where ShipTo_Row.Company == CompanyID
&& ShipTo_Row.CustNum == Customer_xRow.CustNum
&& ShipTo_Row.ShipToNum == "2ndParty"
select ShipTo_Row).FirstOrDefault();
PublishInfoMessage("ShipTo.CustNum: " + ShipTo_xRow.CustNum.ToString() + " ShipTo.ShipToNum " + ShipTo_xRow.ShipToNum, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "MasterUpdate", "ShipTo");
ShipTo_xRow.Name = (string)ttOrderHed_xRow["Character01"];
ShipTo_xRow.Address1 = (string)ttOrderHed_xRow["Character02"];
ShipTo_xRow.Address2 = (string)ttOrderHed_xRow["Character03"];
ShipTo_xRow.City = (string)ttOrderHed_xRow["Character05"];
ShipTo_xRow.State = (string)ttOrderHed_xRow["Character06"];
ShipTo_xRow.ZIP = (string)ttOrderHed_xRow["Character07"];
ShipTo_xRow.CountryNum = (int)ttOrderHed_xRow["Country2ndParty"];
PublishInfoMessage("OrderHed.Char01: " + ttOrderHed_xRow["Character01"] + " OrderHed.Country " + ttOrderHed_xRow["Country2ndParty"], Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "MasterUpdate", "OrderHed");