Hurry! 20% Off Ends SoonRegister Now

How to Define Validation Rules in SalesForce

Validation Rules

Validation rules help you to improve data quality by preventing users from entering incorrect data. We can write one or more validation rules that consist of an error and a corresponding error message.
Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record.

A validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or “False”. Validation rules also include an error message to display to the user when the rule returns a value of “True” due to an invalid value.

  • Determines whether a value must be accepted or not with respect to a field.
  • Validation rules verify that the data a user enters in your app meets the standards that you are specifying. If it doesn’t, then the validation rule prevents the record from being saved, and the user sees an error message that is defined either next to the problematic field or at the top of the edit page.

Defining a validation rule on the date of  joining the field:

→ Select the object where you want to define the Validation rule
→ From the object, go for validation rule property
     ↓
Click on new
Rule name DOJ rule
Active [⁄]
Date of joining—c>Today ()
Error message    ↓
Enter correct date
Error location Top of page Field
  ↓
Save

Page Layouts:

Page layouts control the layout and organization of buttons, fields, s-controls, Visualforce, custom links, and related lists on object record pages. They also help determine which fields are visible, read-only, and required. Use page layouts to customize the content of record pages for your users. It determines the types of fields and their organization to a specific user on a page.

  • A page layout controls the position and organization of the fields and related lists that are visible to users while viewing a record.
  • Page layouts also help us to control the visibility and edit the ability of the fields on a record.
  • We can set fields as read-only or hidden, and we can also control which fields require users to enter a value and which don’t.
  • Page layout should never be used to restrict access to sensitive data that a user shouldn’t view or edit. Although we can hide a field from a page layout, users can still access that field from a page layout and through other parts of the app, such as in reports or via the API.

Creating a new page layout for employee object
Click on you → setup → create → objects → click on employee object → go to properties of employee object → select page layout → new

                            Interested in mastering Salesforce? Enroll now for FREE Demo on Salesforce Online Training

What is the checking for validation?

  1. Data type/ field type
  2. Validation rule

Record Type:

Record types let you offer different business processes, picklist values, and page layouts to different users. The record type is used to create an interface that suits the business process.
Record types are :

  1. Page layouts
  2. Pick lists
  3. Validation rule

Data Model

It is the storage structure to store the data in an efficient way.
→ To create a data model we require

  • Objects
  • Fields
  • Relationships
  • Validation rules
  • Page layout

→ Every project starts from the creation of a data model in which, various objects, fields, relationships and validation rules are defined along with page layouts.
→ The next step in the process is to fetch the data in the data model, there are various mechanisms to fetch data into the data model :

  1. Importing
  2. Data loader
  3. Integration

→ Importing data from CSV file to the DB  ↓
Comma separated value
→ The CSV file can exist anywhere on the system
CSV file
→ Creating CSV file:

  • Go to notepad
  • Write the data appropriate to import
Creating CSV file
  • Save as “ ashok.csv”
  • Finally, we will get a CSV file
Related Article: Salesforce Interview Questions and Answers

Steps to import data through a custom object:

Click on user name → Setup → Administration setup → Data management → Import custom object → Select 6 to start the import wizard
          ↓
Step1:  choose record → From the list below, choose the object label
Product
Step 2:  prevent duplicates
Next
Step 3:  specify relationships

Which user field are you including in your file to designate record owners?
Note
Step 4:  file upload
Choose file
Step 5:  field mapping
Field mapping
Step 6:  verify import settings

Click Import now
Import now ←|

Step 7:  import initiated

Finish ←|
The maximum limit of import data is 50,000 records per session
Per session we import 50 k records only
Session means log in and logout

DATA LOADER 

Data Loader is a client application for the bulk import or export of data. Use it to insert, update, delete, or export Salesforce records
The advantage of using import wizard is that it supports various languages and checks for duplicates.
To overcome the limit of 50 k records per session, we use an Apex data loader.

MindMajix Youtube Channel

Apex data loader:
→ This is a local system software that can import data to SFDC
→ Apex data loader present version is 2.2.0
→ The various operations that can be performed through Apex data loader are:

Insert: creates a record

Update: modifies a record

Upsert: either insert or update

Delete: removes records

Export: fetch data from SFDC


Importing data through Apex data loader to SF:
Importing data through Apex data loader to SF
From the mail, enter the file my personal information
Security token along with your pwd, reset, security token
Login
OK

Mindmajix offers different Salesforce certification training according to your desire with hands-on experience on Salesforce concepts

Salesforce Administration TrainingSalesforce Lightning Training
Salesforce Advanced Developer TrainingSalesforce Developer Training
Salesforce IoT TrainingSalesforce App Builder Certification Training
Salesforce AppExchange TrainingSalesforce Service Cloud Training
and many more.. 

 

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
Salesforce TrainingDec 24 to Jan 08View Details
Salesforce TrainingDec 28 to Jan 12View Details
Salesforce TrainingDec 31 to Jan 15View Details
Salesforce TrainingJan 04 to Jan 19View Details
Last updated: 04 Apr 2023
About Author

Arogyalokesh is a Technical Content Writer and manages content creation on various IT platforms at Mindmajix. He is dedicated to creating useful and engaging content on Salesforce, Blockchain, Docker, SQL Server, Tangle, Jira, and few other technologies. Get in touch with him on LinkedIn and Twitter.

read less
  1. Share:
Salesforce Articles