April 9, 2021

30 Salesforce Field Types: What each field type defines and includes

Salesforce fields are a key component. They define what information is stored in your Salesforce records, and how that data can be accessed. With over 30 different field types to choose from, it can be difficult to know which type of field you need for your particular use case. In this post, we will take a look at each Salesforce Field Type and what they include.

Contents

Salesforce is a powerful sales and marketing software that enables businesses to increase sales, close deals faster, and generate more revenue. 

From sales process management to lead tracking, Salesforce has everything you need for your organization's sales needs. One of the most popular features of Salesforce are the salesforce field types. 

There are many different types of fields in Salesforce which each have their own characteristics. In this blog post we will be discussing the various field types available in Salesforce - what they define and include!

Salesforce's Various Data Types

All variables and expressions in Apex in Salesforce are assigned a data type, such as sObject, primitive, or enum.

Primitives include integers, doubles, longs, dates, datestimes, strings, IDs, and Booleans.

An sObject can be general or specific, such as an Account, Contact, or MyCustomObject c.

The following things are included in this collection:

Primitives, sObjects, user-defined objects, Apex classes-created objects, and collections are all represented as a list (or array).

a smattering of primitives

A primitive-to-primitive map, sObject, or collection is a primitive-to-primitive map.

A typed list of values is called an enumeration.

User-defined Apex classes are used to create objects.

Objects created with the system's Apex classes Null (for the null constant)

Various data types exist, depending on the circumstances. The API has five different data types:

Type-specific ID String Boolean Double

Salesforce variables

The syntax for declaring local variables, as well as creating and initialising many variables in a single line, is comparable to Java.

It will be null if you declare a variable but don't assign a value to it. Null signifies the absence of a value in its most basic form. Any variable with a primitive type can be set to null as well.

Variables can be declared at any point in a block and then inherit scope. Parallel blocks, on the other hand, can change the name of a variable that has already been used in a parent block.

Different Salesforce Field Types Depending on the Data Types and their Transformation Data Types and Field Types in Salesforce Depending on the data types, salesforce fields can be divided into three main categories:

These are some of the field types available for creating a custom object. There may exist other salesforce field types which you will come across while working with salesforce!

Apex class for creating objects. Primitive, sObject or a collection of values are all primitive to primitive maps. A typed list is an enum type and salesforce variables can be declared at any point in the block and then inherit it's scope. Parallel blocks change the name of a variable that has already been used in a parent block.

These salesforce field types are available for creating an sObject:

Text, Text area, Password, Number (with Min and Max), Percent(0-100%), Decimal with Precision and Scale of up to 28 places after the period. Checkbox, Date only date picker, Date and time picker, Email address text type. 

Lookup relationship between two sObjects or a custom object, Multi-select picklist, Picklist (single select), Checkbox list, Radio buttons.

Roll up summary field like Count(distinct) or Sum(field). Currency with precision of four decimal places and currency format mask. Number - Integer with no decimals; Float with up to six decimals; Decimal number between 0 and 100 with up to four decimal places

Salesforce's Various Data Types: All variables and expressions in salesforce are assigned a data type. 

Primitives include integers, doubles, longs, dates, datestimes, strings, IDs and Booleans. An sObject can be general or specific such as an Account Contact or MyCustomObject c.

The salesforce API has five different data types: Type-specific ID String Boolean and Double. 

Salesforce variables can be declared at any point in a block and then inherit scope; Parallel blocks change the name of a variable that has already been used in a parent block.

  1. ID - salesforce gives you an ID type to store the unique identifier of each record. The salesforce API has a specific data type for storing IDs called Ids, which are represented by constants such as $User!
  1. Storing numbers is easy either with Integer or Float types depending on your requirement and Decimal can be used when precision up to 28 numbers after the period is needed.

 Double can store double-precision numbers with a precision of 15 decimal places and salesforce variables have six decimals. 

 Date data type stores date information in salesforce, while datetime types are used to add time information as well on dates. 

  1. Primitive Data Types: These salesforce field types are available to create a custom object like (Date type is used when you want your date formatted as "YYYY-MM-DD" in salesForce).
  1. Text - salesforce text types are used for storing any textual information. salesForce has a maximum limit of 255 characters per field, which can be increased to 32000 using custom settings. 

It is important not to exceed the limit because it will result in an error!

  1. Apex Classes - Apex classes are available for all objects and they have their own data types. For example, an Account object has a name field and a Contact will have a firstName.
  1. sObject - salesforce provides several data types to create custom objects such as picklist for storing multiple values in one field or checkbox list type which is similar except that it stores true/false information instead of the value 'on'/'off'.
  1. Text Area - salesforce text area types are for large amounts of free-form data and it has a maximum limit of 32000 characters. 

Password type is used to store sensitive information like passwords or shared secret keys, which can be masked as asterisks when viewed in salesForce. Number type with Min and Max parameters defines the range allowed for salesforce numbers. 

salesForce Percent type supports the values 0-100% and it has a precision of four decimal places, while Decimal is between 0 to 100 with up to 28 decimals after the period mark.

  1. Checkbox - salesforce check box types are used for single selection in salesForce. Checkbox list data type allows you to select more than one option at a time. 


salesForce Radio button types are similar to checkbox list with the only difference being that radio buttons set an exclusive choice while check boxes allow multiple selections.

  1. Roll up summary fields - salesforce roll-up summary fields can be used for summarized information on related records of another object in salesForce or they can be used to create calculated fields which salesForce does not provide.
  1. String - salesforce string types can be split into smaller strings using the salesForce concatenation operator (+).
  1. Boolean - salesforce boolean data type is represented by Boolean literals which are TRUE and FALSE.
  1. Double - salesforce double data type stores decimal numbers with a precision of 15 digits after the period mark while Float has seven digit precision.
  1. Integer - salesforce integer types are used to store whole numbers, which can be positive or negative. 

SalesForce also provides the data type Long for large numeric values up to nine digits in length. Integer is generally faster than long because it stores only 32-bits of information while a long has 64 bits and so it requires more storage space.

  1. Currency - salesforce currency types are used to store monetary values. salesForce Currency data type has a precision of four decimal places and two digits after the period mark, while Decimal is between 0-100 with a maximum limit of 28 decimals. 

Float stores numbers in scientific format, which means that it uses the character E (which stands for exponent) to represent the power of ten.

salesForce Currency has a better precision than Float, but it is very important not to exceed four decimal places because salesForce will return an error!

  1. DateTime - salesforce Date and time data types are used when you want your date formatted as "YYYY-MM-DD" or "YYMMDD" in salesForce. 

Date type is used for dates up to 2079-12-31 while date time data types are for dates after 1970-01-01 and they store both the date and time information.


  1. Address - salesforce Address data type is used for storing addresses of a person or company, and it has the following four fields: street address line one, street address line two, city name and state/province.
  1. URL - salesforce Url type stores URLs which can be up to 2000 characters in length with all valid URL types like FTP://, FILE://, etc. salesForce Id data type stores unique identifiers or primary keys which are auto generated by salesforce for each record of a custom object.
  1. Decimal - salesforce Decimal is used to store decimal numbers with precision up to 28 digits after the period mark while Double has 15 digit precision and Float seven digit precision.
  2. Unique identifier - salesforce Id data type stores unique identifiers or primary keys which are auto generated by salesforce for each record of a custom object.
  1. Reference - salesforce Reference is used to store references between objects, and it can be of two types: Master-detail reference where the child records relate directly to its parent while Lookup uses another object as its source.
  1. Multi-select pick list - salesforce Multi-select pick list is used to store multiple values from a predefined set of options which are limited, i.e., they cannot be modified and you can only choose the existing option. This picklist field allows users to select more than one value at a time including checkbox fields.
  1. Combobox - salesforce Combobox is used to store a value from either of the two options you provide. This option becomes very useful when one needs to choose between these values at runtime, e.g., currency format or sales tax calculation method.
  1. EncryptedString - salesforce Encrypted string is used to store sensitive data like passwords, PIN numbers in salesForce.
  1. Multi-select picklist - salesforce Multi-select pick list is used to store multiple values from a predefined set of options which are limited, i.e., they cannot be modified and you can only choose the existing option. This picklist field allows users to select more than one value at a time including checkbox fields.
  1. JunctionIdList - salesforce Junction Id list is used to store reference data between objects with the use of foreign keys like in relational databases.
  1. Lookup - salesforce Lookup is also called Master-detail relationship which allows you to find related information by navigating through another object, e.g., finding an employee's manager or department details by looking for their id.
  1. Masterrecord - salesforce Masterrecord is used to store a primary record in salesForce, which can be related to detail records like its child or master-detail relationship.
  1. MultiValueDictionary - salesforce Multi value dictionary stores multiple values for single field where each value corresponds to one record and it has an index of names and corresponding values just like relational database.
  1. OpportunityLineItem - salesforce Opportunity line items are created as part of opportunity object which is used to capture all activities that occur during the sales cycle. This field type contains six fields: Amount, Cost, Product, DiscountTypeID ,ProductDiscountAmount and CampaignName .
  1. Picklist (Standard) - salesforce Picklist (Standard) is used to store a value from either of the two options you provide. This option becomes very useful when one needs to choose between these values at runtime, e.g., currency format or sales tax calculation method.


No items found.

Heba Arshad

Share Post:

Comments System WIDGET PACK

Start engaging with your users and clients today