How to Define Validation Rules in SalesForce
Recommended by 0 users
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 corresponding error message.
Validation rules verify that the data a user enters in a record to meet 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 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
Date of joining—c>Today ()
Error message ↓
Enter correct date
Error location Top of page Field
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 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 requires users to enter a value and which doesn’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
What is the checking for validation?
- Data type/ field type
- Validation rule
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 :
- Page layouts
- Pick lists
- Validation rule
It is the storage structure to store the data in an efficient way.
→ To create data model we require
- Validation rules
- Page layout
→ Every project starts from the creation of 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 :
- Data loader
→ Importing data from CSV file to the DB ↓
Comma separated value
→ The CSV file can exist anywhere on the system
→ Creating CSV file:
- Go to notepad
- Write the data appropriate to import
- Save as “ ashok.csv”
- Finally, we will get CSV file
Steps to import data through custom object:
Click on user name → Setup → Administration setup → Data management → Import custom object → Select 6 starts the import wizard
Step1: choose record → From the list below, choose the object label
Step 2: prevent duplicates
Step 3: specify relationships
Which user field are you including in your file to designate record owners?
Step 4 : file upload
Step 5: field mapping
Step 6: verify import settings
Click import now
Import now ←|
Step 7: import initiated
- Maximum limit of import data is 50,000 records per session
- Per session we import 50 k records only
- Session means login and logout
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.
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:
From the mail, enter the file my personal information
Security token along with your pwd, reset, security token
Enroll for Live Instructor Led Online SalesForce Training