Order validations by Field Policies
Below you will find information about:
Validations are only applied when the request meets the scenario of a Field Policy with configured restrictions (value > 0). If the field is 0(zero), the rule is considered not applicable. The rules are independent of other existing rules (flex balance, bonus balance, etc.).
See how to register and integrate Order validations (restrictions)
Minimum interval between requests of the same type
Section titled “Minimum interval between requests of the same type”- Field: intervaloDeDiasEntrePedidos (INT, default 0)
- Definition: Minimum number of days required between orders issued from the same seller, same Order Type and same company (customer).
- Validation: The system searches for the seller’s last order that simultaneously fulfills: same codVendedor, same codCliente and same field policy rule.
- Blocking: If the difference in days between the current order and the last order is less than the configured interval, saving is blocked.
- Behavior: Displays an informative dialog stating that the last order was less than X days ago.
Maximum quantity of distinct items (SKUs)
Section titled “Maximum quantity of distinct items (SKUs)”- Field: qtdeMaximaDeItens (INT, default 0)
- Definition: Maximum quantity of different SKUs allowed in the order.
- Validation: Occurs when incrementing items, saving items and saving the order.
- Visual indicator: When inconsistent, the item’s inconsistency icon is displayed and, when saving, it displays an informative dialog.
Maximum number of units per SKU
Section titled “Maximum number of units per SKU”- Field: qtdeMaximaDeUnidadesPorItem (INT, default 0)
- Definition: Maximum quantity allowed for the same SKU within the order.
- Validation: Occurs when incrementing items, saving items and saving the order.
- Visual indicator: When inconsistent, the item’s inconsistency icon is displayed and, when saving, it displays an informative dialog.
Minimum freight charge to complete an order
Section titled “Minimum freight charge to complete an order”- Field: valorMinimoFrete (double)
- Definition: Lowest freight charge accepted when saving/completing an order in App Demander, in Brazilian reais (R$). In JSON, use a period as the decimal separator.
- Validation: When a positive minimum exists, App Demander compares the order’s freight charge with the minimum in the currently applicable policy. A lower amount blocks saving/completion, and the message shows the current charge and the required minimum. An equal or higher amount passes this validation; the other order rules are still checked.
- When it does not apply: no applicable policy, no
restricoesblock, orvalorMinimoFreteabsent,null, or0. Older policies keep working without this field. - Order header: when the salesperson or other order header data changes, the system reselects the policy using the existing filters and precedence. Saving/completion uses the minimum from the currently applicable policy. If the new header has no such restriction, the previous minimum must not be retained.
- Carrier: validation also applies when the carrier is hidden or not filled in. It belongs to the order fields policy and is independent of the rules in the Freight Policy register, which remain applicable. No new register or ignored-rule option is required to configure this minimum.
Minimum jsonRegras example to require a freight charge of R$ 50.00:
{"restricoes":{"valorMinimoFrete":50.00}}| Order freight charge | Required minimum | Result of this validation |
|---|---|---|
| R$ 49.99 | R$ 50.00 | Blocks |
| R$ 50.00 | R$ 50.00 | Allows |
| R$ 50.01 | R$ 50.00 | Allows |
Not filled in (null) or R$ 0.00 |
R$ 50.00 | Blocks: an empty freight charge is treated as zero |
Frequently asked questions
Section titled “Frequently asked questions”When are validations applied?
- Validations for maximum quantity of items and maximum quantity per SKU occur in real time: when incrementing, decrementing, entering quantity, adding an item via the carousel and when saving the order.
- Validation of minimum interval between orders occurs when saving the order, searching for the last order via API.
- Validation of minimum freight charge occurs when saving/completing the order, comparing the freight charge entered with
valorMinimoFretefrom the currently applicable policy.
Where are rules configured?
- The rules are configured in Demander Web, in the table Table 280 - Order Field Policies, through the field jsonRegras in the restrictions block.
- They are linked to a policy scenario (seller, customer, type of order, etc.).
What happens if the policy has no restrictions?
- If the restriction block does not exist in the JSON, no restriction validation is performed.
- If the fields exist but have a value of 0 (zero), the rule is also considered not applicable.