Salesforce Apex Language is an extremely robust programming language. Therefore, salesforce developer must use specific attributes and values when setting any variables in it. Here you will get all of the details about data types, field types and components used within Salesforce that may help define any variables correctly.

Let’s see the topics covered in this blog

Check out this YouTube video on Salesforce Tutorial:

Different DataTypes in Salesforce

Apex in Salesforce assigns a data type to all variables and expressions, such as sObject, primitive, or enum. We use these data types as required depending on the condition.

  • Integer, Double, Long, Date, Datetime, String, ID, or Boolean are examples of primitives 
  • An sObject, such as an Account, Contact, or MyCustomObject c, is either general or particular.
  • A collection that includes the following items:
    • A list (or array) of primitives, sObjects, user-defined objects, Apex classes created objects, or collections 
    • a collection of primitives
    • A primitive-to-primitive map, sObject, or collection
  • An enumeration is a typed list of values 
  • Objects made from Apex classes defined by the user
  • Objects built with Apex classes provided by the system
  • Null (for the null constant)

There are different data types depending on the circumstances. Here are the five in API:

  • ID
  • String
  • Boolean
  • Double
  • Varies by type

become a salesforce expert

Variables in Salesforce

  • Declaring and initializing local variables with one line, similar to Java, is possible here.
  • If you declare a variable but fail to assign any value for it, its status will become null – in its simplest form, null signifies a lack of any assigned value for a variable specified with primitive type.
  • Variables can be declared at any point in a block and then take on the scope from there. Sub-blocks can’t change the name of a variable that has already been used in a parent block, although parallel blocks may.

Get 100% Hike!

Master Most in Demand Skills Now !

Go for this in-depth job-oriented Salesforce Training Course now!

Different Salesforce Field Types

Every field within Salesforce has a defined data type. When these fields are created in Salesforce, you are prompted to choose their data type, such as String, TextArea, Number, PickList, etc. It’s important to understand that these fields expect data of a certain type.

Field Type Description
Address A compound data type that contains address field data
AnyType A polymorphic data type that returns a string, picklist, reference, Boolean, currency, int, double, percent, ID, date, dateTime, URL, or email data depending on the kind of field involved
Calculated A field that is defined by a formula
Combobox A Combobox, which includes a set of enumerated values and allows the user to specify a value, not on the list
Currency  Currency values
DataCategoryGroupReference Reference to a data category group or a category unique name
Email Email addresses
EncryptedString An encrypted text field that contains any combination of letters/numbers/symbols stored in an encrypted form; you can set up a maximum length of up to 175 characters; available in API versions 11.0 and later.
ID A primary key field for an object
JunctionIdList A string array of referenced ID values representing the many-to-many relationship of an underlying junction entity; you have to query and manipulate the string array to query and manipulate the underlying junction entities in a single API call.
Location A compound data type that contains latitude and longitude values for geolocation fields
Masterrecord When records are merged, the ID of the record that is saved (the other records are deleted).
Multipicklist A multi-select picklist includes a set of enumerated values from which multiple values can be selected
Percent Percentage values
Phone Phone numbers; values can include alphabetic characters; client applications are responsible for phone number formatting
Picklist Picklist includes a set of enumerated values from which one value can be selected
Reference Cross-references to a different object; analogous to a foreign key field in SQL
Textarea A string that is displayed as a multi-line text field
URL URL values; usually, client applications should display these as hyperlinks

Career Transition

Career Transition to Big Data - Yogesh's Success Story | Big Data Hadoop Course - Intellipaat Review
Intellipaat Reviews - Salesforce Training | Career Transition to Salesforce Marketing Cloud Admin
Salesforce Admin To Salesforce Developer | Got Job With Salary Hike | Intellipaat Career Transition
Intellipaat Reviews - Salesforce Training | Career Transition | Got a New Job With 100% Salary Hike
Got Job As a Salesforce Developer at Ericsson with Salary Hike | Intellipaat Career Transition
How to become a Salesforce Admin | Got Job Just After 1 Month | Intellipaat Career Transition

Learn end-to-end Salesforce concepts through the Salesforce Course in Hyderabad to take your career to a whole new level!

Different Salesforce Field Types Depending on the Data Types and their Transformation Data Types.

We can group different field types together with data types. Some of the examples are listed below.

Data Type Field Types Transformation Data Types
ID Look up relational, master-detail relationship String
String Auto number, email, phone, multi-select picklist, text, text area, long text area, rich text area, data category group reference, and URL String
Boolean Checkbox Integer
Double Currency, formula, number, percent, and roll-up summary Decimal
Varies by type A type must be given when formula fields are added to the user interface. Currency, date, date/time, number, percent, or text are all API data types that correspond to this type. String

Also, read about Record types in Salesforce.

Salesforce Components

  • TAB menu: In this, all tabs are arranged in a row.
  • All TAB menu: In this, you can find all the tabs available on
  • More TAB menu: In this, you can find more tabs available on
  • User menu: This is available at the top with a username. By using this component of Salesforce, you can change your profile settings.
  • Sidebar menu: In this, there are different sections such as build, monitor, jobs, logs, etc.
  • Application menu: It allows shuffling between applications.
  • Search Menu: It helps search in Salesforce.

Want to grab a Salesforce Admin job? Prepare yourself with these Top Salesforce Admin Interview Questions!

Course Schedule

Name Date Details
Salesforce Certification 24 Feb 2024(Sat-Sun) Weekend Batch
View Details
Salesforce Certification 02 Mar 2024(Sat-Sun) Weekend Batch
View Details
Salesforce Certification 09 Mar 2024(Sat-Sun) Weekend Batch
View Details

1 thought on “Salesforce: Data Types, Field Types, and Components”

  1. Good tidings, Generally I never remark on online journals yet your article is persuading to the point that I never stop myself to say something regarding it. You’re working effectively, Keep it up. You can look at this article, may be of help 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *