Change the sales order warehouse on CreateEnd
I'm writing a plugin to change a sales order LogicalWarehosueResidingIn based on a debtor custom field. The debtor custom field denotes which warehouse they require their sales order placed in. The value saved to the database is the INLogicalID.
Piece of cake to get the INLogicalID, but if it's different to the current warehouse then I want to change the sales order warehouse to the one specified from the debtor custom field.
Have tried 3 different ways to change the sales order warehouse but none are working. Need some tips!
Version 7.2.1 SR8. C#.
Piece of cake to get the INLogicalID, but if it's different to the current warehouse then I want to change the sales order warehouse to the one specified from the debtor custom field.
Have tried 3 different ways to change the sales order warehouse but none are working. Need some tips!
Version 7.2.1 SR8. C#.
- Code: Select all
salesOrder.LogicalWarehouseResidingIn.ReadRecord(DefaultWarehouseID); //doesn't work
salesOrder.LogicalWarehouseResidingIn.IN_LogicalID = DefaultWarehouseID; //doesn't work
JiwaFinancials.Jiwa.JiwaApplication.Entities.LogicalWarehouse logicalWH = salesOrder.Manager.EntityFactory.CreateEntity<JiwaFinancials.Jiwa.JiwaApplication.Entities.LogicalWarehouse>();
logicalWH.ReadRecord(DefaultWarehouseID);
salesOrder.LogicalWarehouseResidingIn = logicalWH; //doesn't work