R30316-17 InvoiceOrderLine - Calculate Unit Price From Line Amount

Code 30316-17
Entity Crm.Invoicing.InvoiceOrderLines Entity
Name CalculateUnitPriceFromLineAmount
Attribute UnitPrice
Layer Front-End
Events AttributeChanged(LineAmount)
Priority Normal
Modify YES
Applicable Legislations ALL // no condition needed
Action if (LineAmount != null) {

lineAmount= (lineAmount / (1 - lineStandardDiscountPercent))/ (1 - LineCustomDiscountPercent);

if (Quantity != 0) { UnitPrice= lineAmount / Quantity; }

ELSE

UnitPrice=lineAmount
Description When Line Amount has changed, Unit Price should be recalculated. The Unit Price is equal to the Line Amount increased with the Line Standard Discount Percent and the Line Custom Discount Percent and divided by the Quantity if it is not 0.
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.