Configuring Validation Rules
Validation rule use case: You have a product A and you want to set up a validation rule such that when a user selects Product A and should not be able to enter more than 5 quantity.
To set up a validation rule
- On the Constraint Rule Condition Detail page, in the Criteria section, from Product Scope, select Product.
- In Product, enter Product A as the product and in the Match Conditions section, select Match in Primary Lines and click Save.
- On the Constraint Rule Action Detail page, in Message, type {0} cannot exceed 5 quantity. {0} denotes the condition product.
- From Action Type, select Validation and from Action Intent, select Show Message.
- From Action Disposition, select Warning.
- From Product Scope, select Action Criteria.
- In the Match Conditions section, select Match in Primary Lines and click Save.
- On the Constraint Rule Detail page, scroll down to the Constraint Rule Actions related list and click Edit Criteria.
- From Field, select Line Item : Quantity, from Operator, select greater than, and in Value, type 5. Click OK.
The validation type rule is saved and added. On the catalog page, when a user selects Product A, and enters quantity as 6. The system shows an error message that Product A cannot exceed 5 quantity.