R28293 SalesOrder - Only Return For Sales Order Line Or Historical Unit Cost Has Value

Code R28293
Entity Crm.Sales.SalesOrders Entity
Name OnlyReturnForSalesOrderLineOrHistoricalUnitCostHasValue
Attribute Line.ReturnForSalesOrderLine
Layer Back-End
Events Planning +
Modify NO
Action for every line validate that:

if (ReturnForSalesOrderLine ! = null || HistoricalUnitCost ! = null)

if ((Quantity < 0 || LineAmount < 0) && ReturnForSalesOrderLine ! = null && Product.ProductType.IsStocked == True)

HistoricalUnitCost == null

else

if ((Quantity < 0 || LineAmount < 0) && HistoricalUnitCost  ! = null && Product.ProductType.IsStocked == True)

ReturnForSalesOrderLine == null
Description Return For Sales Order Line and Historical Unit Cost fields are alternative and they cannot have value at the same time in one returning sales order row because they are used to determine the returning cost of the products. If both fields have value the cost determination would be not accurate and ambiguously.

For more information see Sales order row types.
Message Line {LineNo} in '{DocumentText}' is considered to return products (because it has negative quantity or amount) but columns 'Return For Sales Order Line' and 'Historical Unit Cost' are both specified. 'Return For Sales Order Line' and 'Historical Unit Cost' are used to determine the cost at which the products are returned. Clear either 'Return For Sales Order Line' or 'Historical Unit Cost' so that the cost could be unambiguously determined.

Sort Messages By Attribute: LineNo
Introduced In Version 2018
Revocable NO

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