Global variables are defined as a special type of merge fields provided by the Salesforce referencing the data in your organization. These are used to access and display the user and organization information, perform standard actions on records such as creation, deletion etc. These are easily identified as they start with the ‘$’ sign. Any fields of the global variables can be accessed by using the expression in the form of {! $GlobalName.fieldName}. In this article, we will be explaining the usage of global variables in various components, a simple example and the types of global variables.
Are you ready to try our
How to Create a Page Layout
Page layouts control precisely what people see (and are able to modify) on a record page of an object. A well-crafted layout makes data entry efficient and enforces business processes.
Know Your Users’ Needs
Start interviewing stakeholders across Sales, Service, and Ops to find out what fields and associated lists are most important.
Create a rough mockup organizing fields into rational sections, for example, “Customer Info,” “Order Details,” “Support Cases.”
Navigate & Clone
Setup → Object Manager → [Your Object] → Page Layouts
Clone the existing layout (to keep related-list customizations) or click on New.
Design Your Structure
Sections: Drag sections to group items that are related to each other (employ two-column arrangement for packed pages, one-column for basic records).
Headings: Re-title section headings to friendly names (e.g., “Financials” instead of “Billing Info”).
Fill with Components
Fields: Standard/custom fields. Mark required/key fields Required or Read-Only to avoid poor data.
Related Lists: Choose only the most important related lists, e.g., Cases for Support, Opportunities for Sales.
Quick Actions & Buttons: Insert “New Case,” “Log a Call,” or custom buttons (e.g., “Create Warranty Claim”).
Advanced Tricks
Record Types: Create varying layouts for each record type (e.g., “Prospect” vs “Customer”)
Dynamic Forms (Lightning): Dynamic Forms is a feature that allows fields to be placed anywhere—and shown/hidden according to criteria.
Mobile-Only sections: Collapse large sections for the mobile app for faster loading.
Preview and assign
Click Preview As for various profiles so that nothing is left out.
Page Layout Assignment: Mapping page layouts to profiles/record types so that each user gets the correct view.
By mapping page structures to actual end-user workflows—organizing fields, decreasing clicks, and taking advantage of record types—you increase adoption and decrease errors.
Features of Page Layouts
In addition to simply organizing fields, page layouts in Salesforce provide strong controls to customize the UI:
Conditional Visibility: Render or hide sections (with Dynamic Forms) on the basis of record types—i.e., render “Renewal Info” only when record type is “Customer”.
Compact Layout Overrides: Select a different compact layout for the highlights panel compared to the full page layout for detailed entries.
In-Line Field Editing: Enable users to edit fields on the detail page itself without going to the edit page—perfect for making fast status changes.
Improved Related List Actions: Control what quick actions are shown on related lists—for example, allow reps to create a follow-up task directly from the Opportunity related list.
Read-Only & Required Toggles: Apply business rules at the page layout level—avoid edits on closed opportunities, mandate a “Reason Lost” field prior to transition to “Closed Lost.”
Multi-Column Sections: Employ multi-column designs to render summary statistics next to form fields—enhancing managers’ top-level visibility.
Help Text & Field Descriptions: Include directions alongside complicated fields to inform the client, minimizing support requests and training required.
Take advantage of page-layout capabilities—such as conditional visibility, inline edits, and dynamic forms—to design intuitive, role-tailored record pages that improve data integrity and end-user satisfaction.
How to Create a Mini Page Layout (Compact Layout)
Compact (mini) designs control which fields are shown on the highlights panel, hover cards, and related-list previews—providing a quick overview without drilling in.
Determine Key “At-a-Glance” Fields
Identify the 3–5 most important fields that need to be viewed immediately by users (e.g., Stage, Close Date on Opportunities).
Navigate and Create
Setup → Object Manager → [Your Object] → Compact Layouts
Click on New, title it for instance “Opp Highlights,” and choose a maximum of 10 fields in preference sequence.
Assign to Record Page
Click on Compact Layout Assignment after saving, and set your new layout as Primary for Lightning.
Test in context
Hover over a record link from a related list or look at the highlights panel on the record page to ensure order and relevance.
Iterate and Refine
Collect user feedback—if they lack a main date or owner, alter field sequence.
For instance: On a Contact record, rank {!$User.Role}, {!Contact.Title}, {!Contact.Email}, {!Contact.Phone} for rapid outreach context
Key Characteristics of Mini Page Layouts
Compact designs are not necessarily “smaller” page designs; they manage several different UI components:
Highlights Panel Configuration: Handles top-of-page banner fields—ideal for major status indicators, aggregates, or ownership details.
Hover-Over Cards: Specifies what fields are displayed when a link on a related-list is hovered over—accelerates record choice without navigation.
Mobile “Compact” Cards: Powers data displayed within the record list views and previews of the Salesforce mobile app.
Action Overrides: You can pair compact layouts with quick actions so that they appear next to high-priority fields in line with them (e.g., “Log Call” beside Owner).
Conditional Fields: With Dynamic Forms, even some of the fields can be made conditional—only display “Renewal Date” when record type is “Subscription.”
Employ compact designs to build contextual, click-less snapshots that present key information front and center on Desktop, Mobile, and hover-over experiences.
How to Create a Search Layout
Search layouts determine which columns and actions are shown within global search, object search, lookup dialogs, and list views.
Select Your Experience
Classic: Setup → Create → Objects → [Your Object] → Search Layouts for Salesforce Classic
Lightning: Setup → Object Manager → [Your Object] → Search Layouts
Identify Key Layout Types
Results: Columns displayed on international and object-specific search.
Lookup Dialogs: Fields within the popup when selecting related records.
List views: Automatic columns for “Recently Viewed,” “All,” etc.
Edit and Rearrange Fields
Click Edit next to each layout type.
Put records on which column is being referenced by a cross-tabbed row label.
Add Actions
Select which row actions are shown (Edit, Delete, Custom Buttons).
Save and Validate
Conduct some lookups and global searches to ensure that your design enhances accuracy and efficiency.
Best Practice: Include a minimum of one distinct identifier (such as Account Number) to distinguish similarly named records on lookup dialogs.
Features of Search Layouts
Search layouts provide detailed control over various UI surfaces:
Global Search Columns: Specify which fields are displayed when users search from the top-bar search input box—perfect for bringing in the most important record detail at a glance.
Lookup Fields: Customize columns within the “Lookup” window so that the users are able to easily choose the correct related record.
List View Defaults: Configure which columns appear on default list views (Recently Viewed, All Accounts, etc.) to expedite navigation.
Row Actions in Lists: Support inline actions like Log a Call and Change Owner within list view rows for efficient bulk actions.
Lightning-enhanced lists: Enable full-width row display, avatar icons, and hover details for added context.
Cross-Object Search: Control whether lookup dialogs may search across several objects or only one object type.
By optimizing search designs, you minimize lookup errors and enable people to browse large sets with confidence and efficiency.
Where the global variables are used?
Global variables are used in the following components of Salesforce:
- visualforce pages
- flows
- formulas
- validation rules
- process builder
- custom buttons and links
Example:
For example, let’s consider there is a visualforce page that would display the information about the currently logged-in user to the organization. This can be achieved by using the global variable called ‘$User’. The information about the user is accessed by using the expression {! $User.fieldName}.
Types of Global variables:
There are different types of global variables with distinct functionality. Below are some of the most commonly used global variables in Salesforce.
$Action:
It is a global merge field type used for referencing standard Salesforce actions such as creating, updating and deleting the records. It is a merge field with the format $Action.object.action.
Example: The below example references to the standard action for creating a new account using $Action.Account.New merge field in a visualforce page.
<apex:outputLink value="{!URLFOR($Action.Account.New)} "> Create New Account</apex:outputLink>
Following are the few actions performed with $Action global variable:
- $Action.Product2.Add: It adds a product to a price book. This is only available for product objects.
- $Action.Product2.Clone: It clones a record. This is available for contact, lead, case, and product, etc.
- $Action.Attachment.Download: It downloads an attachment. This is used for attachment and documents
Usage: This global variable is used custom buttons and links, and Visualforce pages.
$Api:
It is a global merge field type used for referencing API URLs.
Example: {!$Api.Session_ID} returns the session id of the current session.
The following are the expressions used with $Api global merge field.
- { !$Api.Enterprise_Server_URL__xxx }: It is an enterprise WSDL SOAP endpoint where xxx represents the version of the API. For example, { !$Api.Enterprise_Server_URL_440 } expression references to the version 44.0 of the API
- { !$Api.Partner_Server_URL__xxx }: It is a partner WSDL SOAP endpoint where xxx represents the version of the API.
Usage: This global variable is used custom buttons and links, Visualforce pages, flow formulas, and process formulas.
Are you ready to try our
$ObjectType:
It is a global merge field type used for referencing standard and custom objects and the values of their fields.
Example:
- { !$ObjectType.Account.Fields. Name.Label } returns the label for the Account name.
- { !$ObjectType.Account.Fields. Name.Type } returns the data type of the Account name.
Usage: This global variable is used custom buttons and links, Visualforce pages, and validation rules.
$Organization:
It is a global merge field type used for referencing information about an organizational profile.
Example:
- {!$Organization.Country} returns the value of a country that is currently stored as part of your company information in Salesforce.
- {!$Organization.Phone} returns the value of the phone that is currently stored as part of your company information in Salesforce.
Usage: This global variable is used in custom fields, validation rules, Visualforce expressions, flow formulas, process formulas, and workflow rules.
$Page:
It is a global merge field type used for referencing another visual force page.
Example: The following example provides a link to a visualforce page ‘otherVFPagename’.
<apex:page>
<h1>Linked</h1>
<apex:outputLink value="{!$Page.otherVFagename}">
This is a link to another page.
</apex:outputLink>
</apex:page>
Usage: This global variable is only available for visual force pages.
$User:
It is a global merge field type used for referencing the information about the currently logged-in user to the organization.
Example:
- {!$User.Username} returns the username of currently logged in Salesforce user.
- {!$User.isActive} returns the active status of the logged in user.
Usage: This global variable is used custom buttons and links, Visualforce pages, validation rules.
$Permission:
It is a global merge field type used for referencing the current logged in user’s custom permissions (which gives the user access to custom processes or apps) access.
Example:
- $Permission . customPermissionName will return the true if the current user has an access to custom permission
Usage: This global variable is used custom buttons and links, Visualforce pages, validation rules.
Conclusion:
This article explains the usage of global variables, types of global variables with few examples. We sincerely hope that this was useful and any comment of feedback will be very helpful.
Now, you can easily integrate your Salesforce CRM with the back-end ERP system to automate the business process!
Are you ready to try our