Data Types in Salesforce

Salesforce Data Type

Every field has a data type. A data type indicates what kind of information the field stores. There are three types of data types in Salesforce.

  1. Read Only
  2. Relationship
  3. Generic

Read Only Data Types

Auto Number

The auto number is a system-generated sequence number that uses a display format you define. The number is automatically incremented for each new record. The auto number automatically assigns a unique number to each record. The maximum length of any auto-number field is 30 characters, 20 of which are reserved for a prefix or suffix text. Not available for external objects.

Formula

A read-only field that derives its value from a formula expression you define. The formula field is updated when any of the source fields change. Not available for external objects. Formula field gives you control of how your data is displayed.

Roll-Up Summary 

Automatically displays the record count of related records or calculates the sum, minimum, or maximum value of related records. The records must be directly related to the selected record and on the detail side of a custom master-detail relationship with the object that contains the roll-up summary field. Not available for external objects.

Relationship Data Types

Hierarchical Relationship

Creates a hierarchical lookup relationship between users. Allows users to use a lookup field to associate one user with another that neither directly nor indirectly refers to itself. For example, you can create a custom hierarchical relationship field to store each user’s direct manager.

Indirect Lookup Relationship

An indirect lookup relationship links a child’s external object to a parent standard or custom object. When you create an indirect lookup relationship field on an external object, you specify the parent object field and the child object field to match and associate records in the relationship. Specifically, you select a custom unique, external ID field on the parent object to match against the child’s indirect lookup relationship field. The child lookup field’s value comes from an external data source.

Lookup Relationship

Creates a relationship between two records so you can associate them with each other.

 For example, opportunities have a lookup relationship with cases that lets you associate a particular case with an opportunity.

On a standard or custom object, a lookup relationship creates a field that allows users to click a lookup icon and select another record from a window.

On an external object, the lookup relationship field references 18-character Salesforce IDs that are stored in an external data source. Those IDs are matched against the parent object to determine which records are related to each other.

On the parent record, you can display a related list to show all the records that are linked to it. You can create lookup relationship fields that link to users, standard objects, or custom objects. If a lookup field references a record that has been deleted, Salesforce clears the value of the lookup field by default. Alternatively, you can choose to prevent records from being deleted if they’re in a lookup relationship.

Lookup relationship fields aren’t available in Personal Edition.

Lookup relationship fields to campaign members aren’t available; however, lookup relationship fields from campaign members to standard or custom objects are available.

Master-Detail Relationship

Creates a relationship between records where the master record controls certain behaviors of the detail record, such as record deletion and security.

Not available for Standard objects or external objects, although you can create a master-detail relationship field on a custom object that links to a standard object.

Master-detail relationships can’t be used with campaign members.

External Lookup Relationship

Creates a relationship that links this object to an external object whose data is stored outside the Salesforce org.

When you create an external lookup relationship field, the standard External ID field on the parent external object is matched against the values of the child’s external lookup relationship field. External object field values come from an external data source.

Generic Data Types

Checkbox

Check box Allows users to check a box, indicating a true (checked) or false (unchecked) attribute of a record. When using a checkbox field for a report or list view filter, use “True” for checked values and “False” for unchecked values. The Data Import Wizard and the weekly export tool use “1” for checked value and “0” for unchecked value.

Currency

Allows users to enter a currency amount. The system automatically formats the field as a currency amount. This formatting is useful if you export data to a spreadsheet application. Not available for external objects.

Date

Allows users to enter a date or pick a date from a popup calendar. 

Date/Time 

Allows users to enter a date or pick a date from a popup calendar and enter a time of day. There are visual and behavioral differences between the Date/Time fields in Lightning Experience and Salesforce Classic. In Lightning Experience, the date and time fields are separate, and the initial time is set to 12:00 PM when you select a date in the calendar. In Salesforce Classic, the date/time field is a single field. You can set the field to the current date and time by clicking the date and time link next to the field. The time of day includes AM or PM notation. In reports, you can limit the data by specific dates and times using any custom date field.

Email

Allows users to enter an email address of up to 80 characters, which is validated to ensure proper format. If this field is specified for a contact or lead, users can choose the address when clicking Send an Email. Note that custom email addresses cannot be used for mass emails.

You can’t use custom email addresses for mass emails or list emails.

Emails sent to a record’s custom email address fields aren’t logged against that record.

Geolocation

Allows users to specify a location by its latitude and longitude. and can be used to calculate distance. Geolocation is a compound field that counts toward your org’s limits as three custom fields: one for latitude, one for longitude, and one for internal use. Not available for external objects. 

Number

Allows users to enter any number. Leading zeros are removed. In Lightning Experience, custom objects can store more decimal places than you define. If you enter 90.678 on a field that accepts 2 decimal places, the number is displayed as 90.68 on the record form. When you inline edit, the field shows the original input, 90.678. Similarly, the value is stored as 90.678 in the database. In Salesforce Classic, the input 90.678 is saved as 90.68.

Percent

Allows users to enter a percentage number as a decimal—for example, 0.10. The system automatically converts the decimal to a percentage—for example, 10%.

Phone

Allows users to enter any phone number. The character limit is 40.

Salesforce automatically formats it as a phone number.

If you use Salesforce CRM Call Center, custom phone fields are displayed with the Click-to-dial button, allowing click-to-dial functionality. Therefore, Salesforce recommends that you don’t use a custom phone field for fax numbers.

Picklist

Let users select a single value from a list that you define. Available for external objects only with the cross-org adapter for Salesforce Connect.

Picklist (Multi-Select)

Allows users to select more than one picklist value from a list that you define. These fields display each value separated by a semicolon. Available for external objects only with the cross-org adapter for Salesforce Connect.

Text

Allows users to enter any combination of letters, numbers, or symbols. You can set a maximum length, of up to 255 characters.

Text Area

Allows users to enter up to 255 characters that display on separate lines similar to a Description field.

Text Area (Long)

Allows users to enter up to 131,072 characters that display on separate lines similar to a Description field. You can set the length of this field type to a lower limit if desired. Any length from 256 to 131,072 characters is allowed. The default is 32,768 characters. Every time you press Enter within a long text area field, a line break, and a return character are added to the text. These two characters count toward the 131,072-character limit. This data type isn’t available for activities or products on opportunities. The first 999 characters in a standard rich text area or a long text area are displayed in a report. For custom fields, only the first 255 characters are displayed. If you download the report as Details Only, the entire field is available.

Text Area (Rich)

With the use of a toolbar, users can format the field content and add images and hyperlinks. The toolbar allows the user to undo, redo, bold, italicize, underline, strikeout, add a hyperlink, upload or link to an image, modify alignment, add a numbered or non-numbered list, indent, and outdent. The maximum field size is 131,072 characters, inclusive of all the formatting and HTML tags. The first 999 characters in a standard rich text area or a long text area are displayed in a report. For custom fields, only the first 255 characters are displayed. If you download the report as Details Only, the entire field is available. The maximum size for uploaded images is 1 MB. Only gif, jpeg, and png file types are supported. Not available for external objects. There are visual and formatting differences for rich text areas in Lightning Experience and the Salesforce mobile app, compared to Salesforce Classic. Text (Encrypted)

Allows users to enter any combination of letters, numbers, or symbols that are stored in encrypted form. You can set a maximum length of up to 175 characters. Encrypted fields are encrypted with 128-bit master keys and use the Advanced Encryption Standard (AES) algorithm. You can archive, delete, and import your master encryption key. To enable master encryption key management, contact Salesforce. Not available for external objects.

Time 

         Allows users to enter a time of day, including hours, minutes, second, and milliseconds. Append a “Z” at the end to denote Greenwich Mean Time (GMT).17:30:45.125, 17:30:45, 17:30, and 17:30:45Z are all examples of valid entries. The time displays in a 12-hour notation with AM or PM. The displayed time depends on the Locale setting on the Company Information page in Setup.

URL   

Allows users to enter up to 255 characters of any valid website address. Only the first 50 characters are displayed on the record detail pages. When a user clicks the field in Salesforce Classic, the URL opens in a separate browser window. In Lightning Experience, internal URLs open in the same window, and external URLs open in a separate browser window. In Salesforce console apps, the URL opens in a new workspace tab. In Lightning console apps, internal URLs open in a new workspace tab and external URLs open in a separate browser window.

Leave a Reply

Related Posts

Ameer. M.A

Full Stack Developer

I am a Full Stack web developer, Progressive Web Apps (PWA) Developer, Hybrid mobile app developer, and ERP consultant from Kerala, India.

Ameer. M.A

Explore