Salesforce Apex Language is a very robust language and therefore a salesforce developer needs to use the right attributes and the proper values to define any variables. In this blog, you will get to know about all the details like data types, field types, and a few salesforce components used in Salesforce.
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 it is required depending on the condition.
- 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:
- 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 kinds of data types depending on conditions. The five different data types in API:
- Varies by type
Learn more about string data type from our blog on Apex String class now.
Variables in Salesforce
- The syntax for declaring local variables, defining and initializing the multiple variables in a single line, is similar to that of Java.
- If you declare a variable but don’t assign a value to it, it will be null. In its simplest form, null denotes the lack of a value. Any variable specified with a primitive type can also be set to null.
- 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 !
Learn more about Salesforce Automation System in this insightful blog 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 its data type such as String, TextArea, Number, PickList, etc. It’s important to understand that these fields expect data of a certain type.
||A compound data type that contains address field data
||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
||A field that is defined by a formula
||A Combobox, which includes a set of enumerated values and allows the user to specify a value, not on the list
|| Currency values
||Reference to a data category group or a category unique name
||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
||A primary key field for an object
||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
||A compound data type that contains latitude and longitude values for geolocation fields
||When records are merged, the ID of the record that is saved (the other records are deleted)
||Multi-select picklist includes a set of enumerated values from which multiple values can be selected
||Phone numbers; values can include alphabetic characters; client applications are responsible for phone number formatting
||Picklist includes a set of enumerated values from which one value can be selected
||Cross-references to a different object; analogous to a foreign key field in SQL
||A string that is displayed as a multi-line text field
||URL values; usually, client applications should display these as hyperlinks
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.
||Transformation Data Types
||Look up relational, master-detail relationship
||Auto number, email, phone, multi-select picklist, text, text area, long text area, rich text area, data category group reference, and URL
||Currency, formula, number, percent, and roll-up summary
|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.
Go for this in-depth job-oriented Salesforce Training Course now!
- TAB menu: In this, all tabs are arranged in a row.
- All TAB menu: In this, you can find all the tabs available on salesforce.com.
- More TAB menu: In this, you can find more tabs available on salesforce.com.
- 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!