Christmas Special : Upto 40% OFF! + 2 free courses  - SCHEDULE CALL

sddsfsf

What are The Various Data Types Available in Salesforce

 

A salesforce developer must declare all variables using the proper traits and values because the Salesforce Apex Language is so potent. All the details, such as data types, field types, and a few Salesforce components, are covered in this article.

Different DataTypes in Salesforce

All variables and expressions in Apex in Salesforce are given a data type, such as sObject, primitive, or enum. These data types are utilised because they are necessary given the circumstance.

  • Integer, Double, Long, Date, Datetime, String, ID, or Boolean are examples of primitives 
  • A sObject, such as an Account, Contact, or MyCustomObject c, is either general or particular.

 A Collection That Includes The Following items:

1. A list (or array) of primitives, sObjects, user-defined objects, Apex classes created objects or collections 

2. A collection of primitives

3. 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)

Data Types And Field Types

Sfdc Data Types And Field Types: We will learn what the various data types are in this blog as well as the various field kinds. The names of data types and field types in user names are typically the same. Depending on the circumstance, we employ several Data kinds.

There are typically 5 different data kinds in API. Those are

  1. ID
  2. String
  3. Boolean
  4. Double
  5. Varies by type

Depending on the data kinds, we can categorise various field 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: A system-generated sequence number that employs a certain display format that we set is used when auto number data types are chosen. For each new record we produce, the auto-generated number will be increased.

Formula: When the Formula data type is chosen, a variety of Formula expressions that produce values can be generated. Every time the source field is modified, the formula field is also modified. It is a sort of read-only field.

  • Top of Form
  • Bottom of Form
  • Roll-up Summary: Additionally a read-only field type is roll-up summary. The record count of all records listed in a connected list or the sum, minimum, and maximum values of a field in a related list can be calculated using the Roll-up Summary data type.

Lookup Relationship: Two objects are linked by this type of data type. We can use a lookup relationship to connect one object to another. A pop-up list of values is available for the user to choose from in this data type field.

Master-Detail relationship: The master-detail relationship likewise connects two items, but it establishes a unique kind of parent-child interaction.

Checkbox: If a user wants a boolean function like true or false this Checkbox data type is used.

Currency: The currency field type allows the user to enter INR or any other country currency values in the record.

Date: Allows the user to enter a date or we can select the date from a popup calendar.

cta11 icon

Salesforce Course Training

  • Personalized Free Consultation
  • Access to Our Learning Management System
  • Access to Our Course Curriculum
  • Be a Part of Our Free Demo Class

Date/Time: The field types for date and date/time are distinct from one another. The user can choose a date from the pop-up calendar under Date/Time, and they can also input the current time in the Date/Time field.

Email: Allows users to enter their Email addresses.

Geolocation: Allows users to enter latitude and longitude values.

Number: Allows users to enter numbers.

Percent: Automatically percentage sign is added.

Phone: Allows users to enter their Phone Numbers.

Picklist: Allows users to select only one list from a group of lists that we defined. Picking one among many.

Text: Allows users to enter a combination of both letters and numbers.

Text Area: Up to 255 characters of letters and numbers can be entered by users.

Text area (Long): Users are given the option to enter up to 32,768 characters on different lines.

Text Area (Rich): Allows users to enter formatted text, and add images and links up to 32,768 characters on separate lines.

Text(Encrypted):  Allows users to enter any combination of letters and numbers to store in an encrypted format.

URL: Allows users to enter a valid website address.

Auto-Number:  Auto-number is a system-generated sequence number used to display format whatever we define. Automatically incremented for each new record.

Formula: A formula field is a read-only field that gets values from the formula expression that is defined. Formula field type changes, when the source field changes.

Roll-Up Summary: The roll-Up Summary field is a read-only field that displays the sum, min, and max values of a field in a related list.

Lookup Relationship: A relationship between two objects is established using the lookup relationship field (parent object and child object). With this field type, users can choose a value from a pop-up list by clicking on a lookup icon.

Master-Detail Relationship: The master-Detail relationship field creates a specific type of parent-child relationship.

Checkbox: The checkbox field type allows users to select a True(checked) or False (Unchecked).

Currency: The currency field allows users to select a Dollar or any other country's currency amount. This field type is used to export data to Excel sheets or spreadsheets.

Get Hands-on Practical Salesforce Training with Instructor-led Classes

  • Instructor-led Sessions
  • Real-life Case Studies
  • Assignments

Picklist (multi-select) : Allows users to select many from a group of the list that is defined.

Data Types: "A data type is a group of data in a computer language that contains values with predetermined features. Integer, floating point unit number, character, string, and pointer are a few examples of data types. Such data types are typically pre-built into a language in a small number. The language often defines the range of values for a particular data type, as well as how the values are stored and processed by the computer.

“Apex is a strongly typed, object-oriented programming language. Just like any other  programming language, Apex has a variety of data types that you can use.”

Refer Salesforce self-learning course to learn more

1). Primitive Types – These data types include String, Integer, Long, Double, Decimal, ID, Boolean, Date, Datetime, Time, and Blob. All these data type variables are always passed by value in methods.  Another thing to keep in mind is that when a variable is declared in Apex, it is initialised to null. Prior to utilising, you must explicitly initialise to non-null variables.

Built-in Type

Meaning

Blob

“A collection of binary data stored as a single object.”

Boolean

“A value that can only be assigned true, false, or null. For example:Boolean is winner = true;”

Date

“A value that indicates a particular day. Date values do not provide any time-related information, unlike Datetime values. A system static method must always be used to construct date values.

Datetime

“A value that indicates a particular day and time, such as a timestamp. A system static method must always be used to construct datetime values.

Decimal

“A number that includes a decimal point. Decimal is an arbitrary precision number. Currency fields are automatically assigned the type Decimal.”

Double

“A 64-bit number that includes a decimal point. Doubles have a minimum value of -263 and a maximum value of 263-1. For example:Double d=3.14159;”

ID

“Any valid 18-character Force.com record identifier. For example:ID  =’00300000003T2PGAA0′;”

Integer

“A 32-bit number that does not include a decimal point. Integers have a minimum value of  -2,147,483,648 and a maximum value of  2,147,483,647. For example:Integer i = 1;”

Long

“A 64-bit number that does not include a decimal point. Longs have a range of values between -263 and 263-1. When you require a range of values wider than those offered by Integer, use this data type. For example:Long l = 2147483648L;”

String

“Any set of characters surrounded by single quotes. String s = "The swift brown fox leaped over the slow dog," for instance;"

Time

“A value that indicates a particular time. A system static method must always be used to construct time values.

2). sObject Types ”This is a special data type in Apex”. A Force.com object can be represented using the generic data type sObject. It could be a Custom object that you define or a Standard object like Account, Opportunity, etc. Listed below are a few instances of sObject variables - As you can see above, your custom objects differ from the Force.com standard objects by having the suffix __c. The dot notation can be used to access fields from the sObject variable.

3). Collections – Apex has 3 types of collections. Lists, Sets, and Maps.

  •  A list is like an array, a sequential collection of elements with the first index position as zero. A list can contain elements of primitive types, sObjects, user-defined objects, Apex objects, or even other collections. A list can contain up to four levels of nested collections. The list can contain duplicate elements.
  • A set is also a collection of elements and elements can be of any data type. Unlike a list, a set contains unique elements and elements in a set are not in any specific order.
  •  A map is a collection of key-value pairs. Keys and values can be any data type. Because the sequence of map pieces is unreliable, keys are unique and must be used to access them.

4). Enums – Enum type represents a fixed set of named constants, same like in other programming languages. A data type called an enum has a fixed set of constants in it. It can be used to find directions (NORTH, SOUTH, EAST, and WEST), days of the week (SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, and SATURDAY), etc. Implicitly, the enum constants are static and final.

CRM and Salesforce are becoming interchangeable terms. Salesforce may be used by businesses to manage contacts, engage customers, create workflows, manage tasks, and track opportunities. Additionally, a mobile dashboard lets you perform analytics, connect with coworkers, and access Salesforce.

 

Trending Courses

Cyber Security icon

Cyber Security

  • Introduction to cybersecurity
  • Cryptography and Secure Communication 
  • Cloud Computing Architectural Framework
  • Security Architectures and Models
Cyber Security icon1

Upcoming Class

0 day 27 Dec 2024

QA icon

QA

  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing
QA icon1

Upcoming Class

1 day 28 Dec 2024

Salesforce icon

Salesforce

  • Salesforce Configuration Introduction
  • Security & Automation Process
  • Sales & Service Cloud
  • Apex Programming, SOQL & SOSL
Salesforce icon1

Upcoming Class

3 days 30 Dec 2024

Business Analyst icon

Business Analyst

  • BA & Stakeholders Overview
  • BPMN, Requirement Elicitation
  • BA Tools & Design Documents
  • Enterprise Analysis, Agile & Scrum
Business Analyst icon1

Upcoming Class

0 day 27 Dec 2024

MS SQL Server icon

MS SQL Server

  • Introduction & Database Query
  • Programming, Indexes & System Functions
  • SSIS Package Development Procedures
  • SSRS Report Design
MS SQL Server icon1

Upcoming Class

0 day 27 Dec 2024

Data Science icon

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning
Data Science icon1

Upcoming Class

7 days 03 Jan 2025

DevOps icon

DevOps

  • Intro to DevOps
  • GIT and Maven
  • Jenkins & Ansible
  • Docker and Cloud Computing
DevOps icon1

Upcoming Class

-1 day 26 Dec 2024

Hadoop icon

Hadoop

  • Architecture, HDFS & MapReduce
  • Unix Shell & Apache Pig Installation
  • HIVE Installation & User-Defined Functions
  • SQOOP & Hbase Installation
Hadoop icon1

Upcoming Class

1 day 28 Dec 2024

Python icon

Python

  • Features of Python
  • Python Editors and IDEs
  • Data types and Variables
  • Python File Operation
Python icon1

Upcoming Class

0 day 27 Dec 2024

Artificial Intelligence icon

Artificial Intelligence

  • Components of AI
  • Categories of Machine Learning
  • Recurrent Neural Networks
  • Recurrent Neural Networks
Artificial Intelligence icon1

Upcoming Class

8 days 04 Jan 2025

Machine Learning icon

Machine Learning

  • Introduction to Machine Learning & Python
  • Machine Learning: Supervised Learning
  • Machine Learning: Unsupervised Learning
Machine Learning icon1

Upcoming Class

0 day 27 Dec 2024

 Tableau icon

Tableau

  • Introduction to Tableau Desktop
  • Data Transformation Methods
  • Configuring tableau server
  • Integration with R & Hadoop
 Tableau icon1

Upcoming Class

1 day 28 Dec 2024