R30422-1 ShipmentOrder - Set Customer

Code 30422-1
Entity Logistics.Shipment.ShipmentOrders Entity
Name SetCustomer
Attribute Customer
Layer Front-End
Events AttributeChanged(ToParty)
Priority Normal
Modify YES
Applicable Legislations ALL // no condition needed
Action IF(ShipmentOrder.ToParty?.GetCustomer(EnterpriseCompany) !=null)

using (ShipmentOrder.NoEvents) { ShipmentOrder.Customer = ShipmentOrder.ToParty?.GetCustomer(EnterpriseCompany); }







=>Extension method GetCustomer in PartyExtensions:

Transaction.Query<Customer>().Where(c => c.Party == party && c.EnterpriseCompany.EqualNull(enterpriseCompany)) .OrderByDescending(c => c.EnterpriseCompany).FirstOrDefault();



Description When To Party is changed, Customer should be changed to a customer with same Party and valid for the Enterprise Company. Valid customers are those with the specified Enterprise company or with empty enterprise company. If more than one customers are found,

they are ordered by Enterprise Company in a descending order and the first record is the selected result.
Message
Version Introduced: 2020.1
Revocable YES

* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.