SALESFORCE CRM Validation Rule Create

 

- Info:

- This tutorial shows how to create Validation Rule.

- In this example we create validation rule which is triggered when number of units in inventory is less then number of units sold: Merchandise__r.Inventory__c < Units_Sold__c

- AND(ISPICKVAL(StageName, "Closed") ,Pricebook2Id==NULL)

AND( OR( ISPICKVAL(StageName, "Closed Lost"), ISPICKVAL(StageName, "Closed Won")) ,Pricebook2Id==NULL)

AND(ISPICKVAL(StageName, "Closed Won") ,HasOpportunityLineItem)

 

- Select Application:

- Login

- Force.com App Menu

- Warehouse

 

- Select Object:

- ivor online

- Setup

- Create

- Objects

- Line Item

 

- Add Rule:

- Validation Rules: New

 

- Define Rule:

- Rule Name: Order_in_stock

 

- Insert Field

- Line Item >

- Merchandise >

- Inventory

- Insert

 

- <

 

- Insert Field

- Line Item >

- Units Sold

- Check Syntax (No errors found)

 

- Define Error Message:

- Error Message: You have ordered more items than we have in stock

- Errors Location: Field Units Sold

- Save

 

- Test:

- Tab: Invoice Statement

- Invoice Number: INV-0001

- Line Items: Edit

- Units Sold: 4000

- Save

- Following error message should be displayed:

Error: Invalid Data.

Review all error messages below to correct your data.