Friday, August 9, 2019

Validation rules in salesforce

What is a Validation Rule?

Validation rules in Salesforce are the rules which contains a formula expressions that validates our data and returns a value of “True” or “False.
  • Validation rule contain Formula expressions.
  • It evaluate the data entered by the user.
  • Validation Rule displays error message to user when the enter invalid values.
  • We can create Validation rules in Salesforce for Objects, fields, campaign members etc.
Examples of validation Rules.
  1. Quantity cannot be Negative.
  2. A field to hold only certain values.
  3. Zip code, phone number to entered in certain format.
Let us check with out applying a Validation Rules to Quantity field in Sample Object.
In Sample object we have a field called Quantity. Let us create a record in Samples and enter the quantity value as negative.
Validation rules in Salesforce
As shown above the quantity field is -5o. In general the quantity field must not be negative. In this case we have to apply validation rules. When ever a user enters negative value for a field Quantity then a error message must be displayed to Enter a positive value. Here we have to restrict user by entering negative value.

How to create Validation rules in salesforce?

To create validation rules in salesforce go to Setup | Build | Create | Objects | Sample | Validation Rules.
Validation rules in salesforce
  • Click on new Button to create new validation rule in Sample object.
Validation rules in salesforce
  • Enter Rule Name.
  • Click on Insert field and enter the syntax.
  • Check Syntax whether it has any errors or not.
  • Enter Error message.
  • Enter Error location.
  • Now click on Save button.
Validation rules in Salesforce.com
After creating Validation rule in Salesforce we can not enter negative value for Quantity. If we enter negative value an error message will be displayed at the top of the page as shown above. The record will only get saved when a quantity field is positive value.

How to Activate / Inactivate a validation Rule?

A validation rule in Salesforce can be activated or Inactivated. To de activate Salesforce validation rules follow the steps given below.
Go to Object | Validation Rule | Edit the Validation Rule.
Salesforce Validation rules1
  • Click on Edit Button.
Salesforce Validation rules
  • Uncheck the active Button to deactivate Validation rule in Salesforce
  • Finally click on Save button.

0 comments:

Post a Comment

Social Profiles

Twitter Facebook Google Plus LinkedIn RSS Feed Email Pinterest

Traffic

pop

Popular Posts

Traffic

Powered by Blogger.

BTemplates.com

Blogroll

ClickADu

Ads

Copyright © Salesforce | Powered by Blogger
Design by Lizard Themes | Blogger Theme by Lasantha - PremiumBloggerTemplates.com

Welcome To Salesforce Tutorial