Understanding Data Types in Salesforce
Data types in Salesforce define the kind of data that can be stored in a field. They ensure that the data entered is consistent, valid, and usable for various operations like reporting, automation, and integrations. Salesforce primarily categorizes data into five main types within its API:
- ID
- String
- Boolean
- Double
- Varies by Type
Detailed Breakdown with Examples:
- ID
- What It Is: A unique identifier automatically assigned to each record in Salesforce.
- Example: Every record, whether it’s an Account, Contact, or Custom Object, has a unique 18-character ID like
0011x000003DGbRAAW
. This ensures that each record can be distinctly referenced, especially when creating relationships between objects.
- String
- What It Is: Represents text-based data.
- Example: Fields such as
FirstName
,LastName
, orEmail
use the String data type. For instance, aContact Name
field might contain “Jane Smith.”
- Boolean
- What It Is: Stores true or false values.
- Example: A
Subscribed to Newsletter
checkbox field allows users to indicate whether a contact is subscribed (True) or not (False).
- Double
- What It Is: Handles numerical values that include decimal points.
- Example: A
Discount Percentage
field might store values like15.5
to represent a 15.5% discount.
- Varies by Type
- What It Is: Used for fields like formulas where the resulting data type depends on the formula’s logic.
- Example: A
Total Price
formula field might calculate a value based on other fields and could return a currency type if the formula multiplies quantity by unit price.
We can group different field types depending on the Data types.
ID | Look up relationship, master-detail relationship |
String | Auto number, email, phone, multi select pick list, text, text area, long text area, rich text area, data category group reference and URL |
Boolean | Check box |
Double | Currency, Formula, number, percent and roll-up summary. |
Varies by type | Formula Field |
Different Field Types
Auto number : when auto number data types is selected a system-generated sequence number that uses a certain display format that we define. Auto generated number will be increment for every record we create.
- Example: An
Order Number
field might start at1001
and increment by 1 for each new order (e.g., 1001, 1002, 1003).
Formula : When Formula data type is selected we are able to derive different Formula expressions that derives values. The formula field is updated every time when there is a change in source field. It is a read-only field type.
- Example: A
Total Cost
formula field could calculate the sum ofUnit Price
multiplied byQuantity
(Unit Price * Quantity
).
Roll-up Summary : Roll-up Summary is also a read-only field type. By using this Roll-up Summary data types we are able to make some mathematical calculations like Sum, Minimum, Maximum values of a afield in a related list or the record count of all records listed in a related list.
- Example: On an
Account
record, aTotal Opportunities
field might count all relatedOpportunity
records.
Lookup Relationship : This type of Data type links two objects. we can link on object to another object by Lookup relationship. This data type field allows user to select a value from popup list.
- A
Contact
record might have a lookup to anAccount
, enabling the association of a contact with a specific company.
Master-detail relationship : Master-detail relationship also links two objects but it creates a special type of parent-child relationship between the two objects.
- An
Invoice
(child) linked to aCustomer
(parent). Deleting the Customer would also delete all related Invoices.
Checkbox : If a user wants boolean function like true or false this Checkbox data types is used.
- Example: An
Active Customer
checkbox indicates whether a customer is currently active.
Currency : Currency field type allows user to enter INR or any other country currency values in the record.
- Example: A
Sales Amount
field allows entry of values like$1,500.00
.
Date : Allows user to enter date or we can select the date from popup calendar.
- Example: A
Contract Start Date
field lets users select a date from a calendar.
Date/ time : Date and Date/Time field types are different from each other. In Date/Time the user can select date from popup calendar and also current time is entered in the Date/Time field.
- Example: An
Event Start
field records when an event begins, including the exact time.
Email : Allows users to enter Email address.
- Example: A
Contact Email
field might containjane.doe@example.com
.
Geolocation : Allows users to enter altitude and longitude values.
- Example: A
Store Location
field could map the exact position of a retail outlet.
Number : Allows users to enter numbers.
- An
Employee Count
field might hold values like50
.
Percent : Automatically percentage sign is added .
- Example: A
Completion Rate
field where users can enter75%
.
Phone : Allows users to enter Phone Number.
- Example: A
Customer Support Number
field might display(123) 456-7890
.
Picklist : Allows users to select only on list from a group of lists that we defined. Picking one among many.
- Example: A
Customer Status
field with options like “New,” “Active,” “Inactive.”
Text : Allows users to enter combination of both letters and numbers.
- Example: A
Product Code
field might containPRD-001A
.
Text Area : Allows users to enter up to 255 characters of letters and numbers.
- Example: A
Short Description
field for a product.
Text area (Long) : Allows users to enter up to 32,768 characters on separate lines.
- Example: A
Detailed Product Description
field allows comprehensive information about a product.
Text Area (Rich) : Allows users to enter formatted text, add images and links up to 32,768 characters on separate lines.
- Example: A
Marketing Description
field where users can add formatted text and images.
Text(Encrypted) : Allows users to enter any combination of letters an numbers and store them in encrypted format.
- Example: A
Password
field that encrypts the entered password to protect sensitive information.
URL : Allows users to enter a valid website address.
Picklist (multi-select) : Allows users to select many from a group of list that we defined
- Example: A
Company Website
field might containhttps://www.company.com
.