R33138 MarketingActivityLines - Set Order Quantity

Code R33138
Entity Crm.Marketing.MarketingActivityLines Entity
Name SetOrderQuantity
Attribute OrderQuantity
Layer Front-End
Events AttributeChanged(InStoreAvalableQuantity)
Priority Normal
Modify YES
Applicable Legislations ALL // no condition needed
Action

!!!If any of the following conditions is not fulfilled - Nothing happens!!!

If (MarketingActivity.TargetParty != Null)
AND
(InStoreAvailableQuantity != Null)
AND
COUNT( applicableCustomerProducts* ) > 0

Then Calculate MarketingActivityLine.OrderQuantity as follows:

OrderQuantity =
if ((FIRST(applicableCustomerProducts*).InStoreMaxQuantity - InStoreAvalableQuantity) % OrderMultiple) == 0
, then FIRST(applicableCustomerProducts*).InStoreMaxQuantity - InStoreAvalableQuantity
, else floor
((FIRST(applicableCustomerProducts*).InStoreMaxQuantity - InStoreAvalableQuantity)/OrderMultiple)*OrderMultiple + OrderMultiple

applicableCustomerProducts are CustomerProducts where:
(

  • Customer == MarketingActivity.TargetParty.Customer
  • Product == MarketingActivityLine.Product
  • IsActive == True
  • InStoreMinQuantity != Null AND != 0 AND > MarketingActivityLine.InStoreAvailableQuantity
  • InStoreMaxQuantity != Null AND != 0
  • OrderMultiple != Null AND != 0
    ) > 0

    !!! OrderQuantity.QuantityUnit == Product.QuantityUnit
Description When InStoreAvailableQuantity is changed if the new value is not null and Target Party has a value, then
OrderQuantity is recalculated according the information set in the Customer Product
(if there is an active Customer Product for the current customer and product).

The OrderQuantity is calculated to supplement the new InStoreAvalableQuantity, which should be equal to
InstoreMaxQuantity and if necessary for to round UP with OrderMultiple.
The QuantityUnit of the OrderQuantity is QuantityUnit from the Product definition.



Example 1:
CustomerProduct:
Product.QuantityUnit = pcs
InStoreMinQuantity = 10
InStoreMaxQuantity = 20
OrderMultiple = 4

MarketingActivityLines:
Set InStoreAvalableQuantity = 0 => OrderQuantity = 20 pcs
Set InStoreAvalableQuantity = 4 => OrderQuantity = 16 pcs
Set InStoreAvalableQuantity = 9 => OrderQuantity = 12 pcs
Set InStoreAvalableQuantity = 7 => OrderQuantity = 16 pcs
Set InStoreAvalableQuantity = 7.9 => OrderQuantity = 16 pcs
Set InStoreAvalableQuantity = 8.1 => OrderQuantity = 12 pcs



Example 2:
CustomerProduct:
Product.QuantityUnit = kg
InStoreMinQuantity = 10
InStoreMaxQuantity = 11
OrderMultiple = 0.5

MarketingActivityLines:
Set InStoreAvalableQuantity = 9.000 => OrderQuantity = 2 kg
Set InStoreAvalableQuantity = 9.400 => OrderQuantity = 2 kg
Set InStoreAvalableQuantity = 9.600 => OrderQuantity = 1.5 kg
Message -
Version Introduced: 2022
Revocable YES

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