Black Friday Deal : Up to 40% OFF! + 2 free self-paced courses + Free Ebook - SCHEDULE CALL
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.
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.
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
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
Depending on the data kinds, we can categorise various field types.
Look up relationship, master-detail relationship
Auto number, email, phone, multi-select pick list, text, text area, long text area, rich text area, data category group reference, and URL
Check box
Currency, Formula, number, percent, and roll-up summary.
Formula Field
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.
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.
Salesforce Course Training
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
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.
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.
How To Convert Lookup To Master-Detail?
What Are External And Big Objects In Salesforce?
Cyber Security
QA
Salesforce
Business Analyst
MS SQL Server
Data Science
DevOps
Hadoop
Python
Artificial Intelligence
Machine Learning
Tableau
Download Syllabus
Get Complete Course Syllabus
Enroll For Demo Class
It will take less than a minute
Tutorials
Interviews
You must be logged in to post a comment