Enhance Salesforce with Point and Click Tools

Enhance Salesforce with Point
and Click Tools
Salesforce, Winter ’18
@salesforcedocs
Last updated: December 8, 2017
© Copyright 2000–2017 salesforce.com, inc. All rights reserved. Salesforce is a registered trademark of salesforce.com, inc.,
as are other names and marks. Other marks appearing herein may be trademarks of their respective owners.
CONTENTS
Extend Salesforce with Clicks, Not Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Customize Your Salesforce Org . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Set Up Your Data Your Way . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Deliver Custom Notifications with Platform Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Automate Your Business Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Manage Your Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
Build Your Own Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
Extend the Reach of Your Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 906
Build Your Own Salesforce App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1114
Lightning App Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1133
Resources for the Point & Click Administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1154
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1156
EXTEND SALESFORCE WITH CLICKS, NOT CODE
Ready to go beyond the basics of Salesforce administration? Want to customize your organization, push its boundaries, and enhance
its functionality? You can do that and so much more without writing a single line of code. All you need is your mouse and a sense of
adventure. Enhance your objects, data, and fields, customize your organization’s look and feel, augment your business processes, create
websites, and even create apps—all using point-and-click tools.
Customize Your Salesforce Org
You can customize each of the standard tabs and types of records, including adding custom fields and setting page layouts. You
can also customize search, tagging, and user interface options for your org. In addition, every Contact Manager, Group, Professional,
Enterprise, Unlimited, and Performance Edition user can customize various personal display options.
Set Up Your Data Your Way
Optimize your Salesforce data to fit the unique needs of your users. You can create your own objects with data that fits together in
the ways that make the most sense for you.
Deliver Custom Notifications with Platform Events
Use platform events to deliver secure and scalable custom notifications within Salesforce or from external sources. Define fields to
customize your platform event. Your custom platform event determines the event data that the Force.com platform can produce
or consume.
Automate Your Business Processes
Instead of relying on your users to perform each part of a business process, automate it! The benefits are two-fold: your users can
spend their time on other tasks, and you can trust that the process is always done just so. Salesforce offers tools to automate several
kinds of business processes: workflow processes, approval processes, wizard-based processes, and more. You'll be happy to know
that these tools don't require you to write code—they're all point-and-click.
Manage Your Domains
You can configure domains and their site associations to suit your organization’s unique needs. For example, you can set up a single
domain to host your communities, Force.com, and Site.com sites. Or perhaps you want a single site on more than one domain.
Build Your Own Web Site
You can use Community Builder or Force.com Sites to build out your Salesforce organization with custom pages and apps.
Extend the Reach of Your Organization
Sometimes your users need to work with data and services that are outside your Salesforce org. There’s a variety of ways you can
provide seamless access across org boundaries.
Build Your Own Salesforce App
An app is a collection of items that work together to serve a particular function. Salesforce apps come in two flavors: Classic apps
and Lightning apps. Classic apps are created and managed in Salesforce Classic. Lightning apps are created and managed in Lightning
Experience. You can customize both types of app to match the way your users work.
Resources for the Point & Click Administrator
In addition to online help, Salesforce creates guides and tip sheets to help you learn about our features and successfully administer
Salesforce.
1
Extend Salesforce with Clicks, Not Code
Customize Your Salesforce Org
Customize Your Salesforce Org
You can customize each of the standard tabs and types of records, including adding custom fields
and setting page layouts. You can also customize search, tagging, and user interface options for
your org. In addition, every Contact Manager, Group, Professional, Enterprise, Unlimited, and
Performance Edition user can customize various personal display options.
Watch a Demo:
How to Change the Look and Feel of Salesforce for Your Company (Salesforce
Classic—English only)
Quick demo of how to customize the way Salesforce looks for your organization.
To tailor Salesforce for your org, you can customize the display of the various tabs and other items.
Select a link to get started on any task.
Find Object Management Settings
Salesforce lets you personalize your object model with features like custom fields, page layouts,
and validation rules. Depending on which experience of Salesforce you have enabled, these
customizations are located in different areas of Setup.
Control User Access to Fields
Use field-level security to control user access to fields. Use page layouts to control the layout
and organization of detail and edit pages in Salesforce, the Self-Service Portal, and the Salesforce
Customer Portal. Customize search layouts to change which fields display in search results and
the buttons that display on list views.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
The available customization
options vary according to
which Salesforce Edition you
have.
USER PERMISSIONS
To view setup options:
• View Setup and
Configuration
To customize your org:
• Customize Application
Give Your Users Custom Help Content
You can supply your own custom help content that overrides the standard Salesforce context-sensitive online help topics for your
custom objects, and you can add field-level help that appears when users hover their mouse over a field.
Tailor Business Processes to Different Users
Record types let you offer different business processes, picklist values, and page layouts to different users. You might create record
types to differentiate your regular sales deals from your professional services engagements, offering different picklist values for each.
Or you might display different page layouts for your customer support cases versus your billing cases.
Support Users in Multiple Languages
If your org has multiple languages enabled, use Translation Workbench to maintain your translated labels in your org. You can
manage translated values for any Salesforce supported language.
Find Object Management Settings
Salesforce lets you personalize your object model with features like custom fields, page layouts, and validation rules. Depending on
which experience of Salesforce you have enabled, these customizations are located in different areas of Setup.
Find Object Management Settings in Lightning Experience
Salesforce lets you customize your object model with features like custom fields, page layouts, and validation rules. Most objects are
available from the Object Manager in Setup.
Find Object Management Settings in Salesforce Classic
Salesforce lets you personalize your object model with features like custom fields, page layouts, and validation rules. Depending on
which type of object you want to find, these customizations are located in different areas of Setup.
2
Extend Salesforce with Clicks, Not Code
Find Object Management Settings
Force.com Quick Access Menu
The Force.com quick access menu offers handy shortcuts to customization features.
App Setup Overview
Find Object Management Settings in Lightning Experience
Salesforce lets you customize your object model with features like custom fields, page layouts, and
validation rules. Most objects are available from the Object Manager in Setup.
EDITIONS
Standard Objects and Custom Objects
A standard object, such as Account or Contact, comes out of the box with your Salesforce
organization. A custom object is an object that you or another administrator created.
Available in: Lightning
Experience
Available in all editions
From Setup, at the top of the page, select Object Manager. Select one of the objects in the
list, and then select a specific customization from the left pane.
For example, to add a custom field to the Account object, select Object Manager from the top of the Setup page. Next, select
Account, and then Fields & Relationships. Select New.
3
Extend Salesforce with Clicks, Not Code
Find Object Management Settings
Other Standard Objects
Some standard objects aren’t housed in the Object Manager. Standard objects with more specific purposes and customizations can
be found in Setup using the Quick Find box.
From Setup, enter the object name in the Quick Find box, then select the customization.
Custom Objects
You can also create custom objects from the Object Manager. From Setup, at the top of the page, select Object Manager. Then
select New Object.
External Objects
An external object is similar to custom objects, except that it maps to data that’s stored outside your Salesforce organization.
From Setup, enter External Objects in the Quick Find box, then select External Objects. Next, click one of the external
objects in the list. Then scroll to the section for the specific customization.
For example, to add a custom field to the Orders external object, enter External Objects in the Quick Find box, then select
External Objects. Click Orders, and then scroll to Custom Fields and Relationships.
SEE ALSO:
Point-and-Click Customization: What’s Different or Not Available in Lightning Experience
Find Object Management Settings in Salesforce Classic
Salesforce lets you personalize your object model with features like custom fields, page layouts,
and validation rules. Depending on which type of object you want to find, these customizations
are located in different areas of Setup.
EDITIONS
Available in: Salesforce
Classic
Available in all editions
4
Extend Salesforce with Clicks, Not Code
Find Object Management Settings
Standard Objects
A standard object, such as Account or Contact, comes out of the box with your Salesforce organization.
From Setup, enter the name of the appropriate object in the Quick Find box, then select the specific customization.
For example, to add a custom field to the Case object, enter Case in the Quick Find box, then select Fields under Cases.
Custom Objects
A custom object is an object that you or another administrator created.
From Setup, enter Objects in the Quick Find box and select Objects. Next, click one of the custom objects in the list. Then
scroll to the section for the specific customization.
For example, to add a custom field to the Job Applications object, enter Objects in the Quick Find box, then select Objects.
Click Job Applications, and then scroll to Custom Fields and Relationships.
External Objects
An external object is similar to custom objects, except that it maps to data that’s stored outside your Salesforce organization.
From Setup, enter External Objects in the Quick Find box, then select External Objects. Next, click one of the external
objects in the list. The scroll to the section for the specific customization.
For example, to add a custom field to the Orders external object, enter External Objects in the Quick Find box, then select
External Objects. Click Orders, and then scroll to Custom Fields and Relationships.
Force.com Quick Access Menu
The Force.com quick access menu offers handy shortcuts to customization features.
When you're working on apps or objects, use this menu to jump to relevant app customization
features. It's available from object list view pages and record detail pages.
Note: If drag-and-drop scheduling on list views is enabled, the Force.com quick access menu
isn't visible for list views on accounts, contacts, and custom objects.
• To expand or collapse the menu, click
(or press ALT+;).
• To scroll down the list of the menu, press TAB.
• To select an option on the menu, press ENTER.
EDITIONS
Available in: Salesforce
Classic
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
• To remove the menu from all list views and record pages, click Turn off menu.
To restore the quick access menu:
USER PERMISSIONS
1. From your personal settings, enter Advanced User Details in the Quick Find
box, then select Advanced User Details. No results? Enter Personal Information in
the Quick Find box, then select Personal Information.
To view the Force.com quick
access menu:
• Customize Application
2. Click Edit.
3. Select the Force.com Quick Access Menu checkbox.
4. Click Save.
SEE ALSO:
Personalize Your Salesforce Experience
5
Extend Salesforce with Clicks, Not Code
Rename Object, Tab, and Field Labels
Rename Object, Tab, and Field Labels
You can change the name of almost any object, field, or tab in Salesforce. This simple adjustment
lets you continue using the terminology your users already know and helps them transition to using
Salesforce. However, Salesforce Help and most pages in Setup always display the original names
for standard objects, fields, and tabs.
For example, you can change the name label for the "Accounts" object and related "Accounts" tab
to "Companies", and change the field "Account Name" to "Company Name." When you rename an
object, tab, or field, the new name appears on all pages the user sees, in Salesforce for Outlook, and
in Connect Offline.
Before renaming tabs, objects, fields, and other related labels, review the implementation tips for
administrators.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
If you use person accounts in your Salesforce org, see Renaming Person Account Labels.
USER PERMISSIONS
1. From Setup, enter Rename Tabs and Labels in the Quick Find box, then select
Rename Tabs and Labels.
To rename a tab and field:
• Customize Application
2. Select your default language from the Select Language drop-down list at the top of the
page.
OR
Note: In Hebrew, we recommend keeping tab renaming to a minimum because variable
gender in verbs is not supported and verbs can lose gender agreement.
OR
3. Click Edit next to the tab you want to rename. Click Reset to revert to a tab’s original name.
Note: You can’t reset custom object tab names.
4. Enter the singular and plural forms of the new tab name. Also, if applicable for the language,
select Starts with a vowel sound for labels that start with a vowel to ensure that Salesforce
uses the proper article (such as “a” or “an”). Then click Next.
When you rename a tab or an object, you can’t use the name of another standard tab, custom
object, external object, or custom tab.
5. Enter your labels for the standard field labels and other user interface elements. Be sure to enter
both a singular and plural form for each label that requires it. Select Starts with a vowel sound
for labels that start with a vowel.
Manage Translation
If you are designated as
a translator, you need:
View Setup and
Configuration
To reset renamed tabs:
• Customize Application
OR
Manage Translation
OR
If you are designated as
a translator, you need:
View Setup and
Configuration
Note: Some standard fields, such as Created By and Last Modified By, are
purposely omitted from renaming because they track system information.
EDITIONS
6. Click Save.
Repeat this procedure to translate labels into all other languages used in your organization.
Tip: After renaming a tab or object, rename any custom reports, dashboards, profiles,
permission sets, custom fields, and list views that contain the original name. You can modify
labels using the Translation Workbench. To rename a standard report, click Save As and save
it to a folder designed for your new name.
Other tab customization options include:
Available in: Salesforce
Classic
Person accounts available
in: Enterprise, Performance,
Unlimited, and Developer
Editions
• Individual users can control which tabs and related lists display for their own logins.
• In addition to the standard tabs provided by Salesforce, users can create entirely new custom tabs depending on their Edition. For
more information, see Show Custom Object Data for Your Users.
6
Extend Salesforce with Clicks, Not Code
Rename Object, Tab, and Field Labels
• In Enterprise, Unlimited, Performance, and Developer Edition organizations, you can override the tab home page that is displayed
when a user clicks a standard, custom, or external object tab. For more information, see Override Standard Buttons and Tab Home
Pages on page 971.
Renaming Person Account Labels
If your org uses person accounts, you can rename these standard fields.
Field
Tab
Description
Business Account
Accounts
An account that is not a person account because it does not have
a record type specific to person accounts. This label is primarily
used to clarify the type of accounts you are importing.
Person Account
Accounts
A person account.
Business Contact
Contacts
A contact that is associated with a business account. This label is
primarily used to clarify the type of accounts you are importing.
When you rename the Person Account field label, the renamed label appears in Salesforce:
• As a prefix to differentiate person account fields such as Birthdate and Home Phone from business account fields. For
example, Person Account: Birthdate is available as an account column in opportunity reports.
• In the name of the Is Person Account field and icon. For example, if you rename the Person Account field to
“Consumer,” then Is Person Account becomes Is Consumer.
Note: The Person Account and Business Account field labels are independent from actual record type names.
• To customize person account record types, from the object management settings for person accounts, go to Record Types.
• To customize business account record types, from the object management settings for accounts, go to Record Types.
SEE ALSO:
Considerations for Renaming Tab and Field Labels
Rename the Chatter Tab
Find Object Management Settings
7
Extend Salesforce with Clicks, Not Code
Rename Object, Tab, and Field Labels
Considerations for Renaming Tab and Field Labels
Before renaming standard and custom tabs and fields, learn how those changes affect your users.
• Most standard tabs and objects can be renamed but not all. For example, the Forecasts tab is
not available for renaming. From Setup, enter Rename Tabs and Labels in the Quick
Find box, then select Rename Tabs and Labels to view a list of the tabs and objects you
can rename.
• The renamed labels appear on all user pages in Salesforce including Personal Setup. However,
all pages in the Setup area use the default, original labels.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
• Some standard fields, such as Created By and Last Modified By, are purposely
omitted from renaming because they track system information.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• After renaming tabs, objects, or fields, check the following additional items that may need
manual updates:
USER PERMISSIONS
– Review all list view names. List view names continue to display the original object name
until you change them manually.
– Check standard report names and descriptions for the objects you renamed.
To rename tab and field
labels:
• Customize Application
– Update the titles and descriptions of any email templates that contain the original object
or field name.
To reset renamed tabs:
• Customize Application
– Manually change any other items you customized with the new object or field name. For
example, custom fields, page layouts, and record types may contain the original tab or field
name.
• Connect Offline, Lightning for Outlook, and Salesforce for Outlook use your new names.
• If you have renamed tabs, objects, or fields, you can also replace the Salesforce Help with another URL. Users can view this URL
whenever they click on any context-sensitive help link on an end-user page or within their personal settings. After you replace the
help, the Help & Training link at the very top of every page and all Setup pages will continue to display the Salesforce Help. For
instructions on replacing the online help, see Replace Built-in Help in Salesforce Classic with Custom Help on page 62.
• In Hebrew, we recommend keeping tab renaming to a minimum because variable gender in verbs is not supported and verbs can
lose gender agreement.
SEE ALSO:
Rename Object, Tab, and Field Labels
8
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Control User Access to Fields
Use field-level security to control user access to fields. Use page layouts to control the layout and
organization of detail and edit pages in Salesforce, the Self-Service Portal, and the Salesforce
Customer Portal. Customize search layouts to change which fields display in search results and the
buttons that display on list views.
Important: When you use page layouts to hide fields from detail and edit pages, users can
still access them. Users see fields via reports, search results, list views, and the API. To restrict
field access, use field-level security. Field-level security doesn’t prevent searching on the
values in a field. When search terms match on field values protected by field-level security,
the associated records are returned in the search results without the protected fields and
their values. Also don’t use page layouts to secure data. For example, removing the Edit
button from a page layout doesn’t prevent users from using inline editing. To prevent users
from editing data, use sharing rules, field-level security, page layout field properties, validation
rules, object permissions, and Visualforce pages.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Page layouts and search
layouts available in: All
Editions
Field-level security available
in: Enterprise, Performance,
Unlimited, Developer, and
Database.com Editions
Field-Level Security
• Restrict users’ access to view and edit fields. For example, restrict access in reports, search results, list views, related lists, email and
mail merge templates, custom links, Connect Offline. Also restrict API access and when synchronizing data or importing personal
data.
• Override less-restrictive field access settings in page layouts and mini page layouts. For example, if a page layout requires a field
that’s read-only in field-level security settings, the field remains read-only for the user.
• Override less-restrictive field settings in search layouts. For example, if a field is visible in the search layout but hidden via field-level
security settings, the field remains hidden.
Page Layouts
• Control the layout and organization of detail and edit pages.
• Control which fields, related lists, and custom links users see, on detail and edit pages only.
• Control which standard and custom buttons display on detail pages and related lists.
• Determine whether fields are visible, read only, or required, on detail and edit pages only.
• Determine the fields that users can import data into.
• In Personal, Contact Manager, Group, and Professional Editions, control which fields users can access in related lists, list views, reports,
Connect Offline, email and mail merge templates, custom links, and when synchronizing data.
• In Professional, Enterprise, Unlimited, Performance, and Developer Editions, determine aspects of mini page layouts, including:
– record type
– profile associations
– related lists
– fields and field access settings.
The visible fields and related lists of the mini page layout can be further customized. However, other items inherited from the
associated page layout cannot be changed on the mini page layout. Mini page layouts display selected fields and related lists of
records in the mini view of the console.
Tip: To automatically add a field to all page layouts and make it visible and required everywhere regardless of field-level security,
make it a universally required field.
9
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Feed-based Layouts Overview
Feed-based page layouts make it easier to work with records by providing two separate views: one for the record’s feed, and one
for its details, including related lists.
Create Page Layouts
With the enhanced page layout editor, you can tailor record page layouts to the needs of your users. Add, remove, or reorder actions,
buttons, fields, and sections on a record’s detail page.
Create Feed-based Page Layouts
Make it easier for your users to work with account, contact, lead, opportunity, custom, and external object records by creating
feed-based layouts. These layouts include two separate views: one for the record’s feed and one for its details.
Page Layouts
Page layouts control the layout and organization of buttons, fields, s-controls, Visualforce, custom links, and related lists on object
record pages. They also help determine which fields are visible, read only, and required. Use page layouts to customize the content
of record pages for your users.
Compact Layouts
A compact layout displays a record’s key fields at a glance in both the Salesforce app and Lightning Experience.
Select Fields to Display in the Recently Viewed List on Object Home Pages in Lightning Experience
As a Salesforce admin, you can customize the Recently Viewed list that appears on the home page for most standard and custom
objects. Choose and order the fields to display so that your users see the information that’s most important for your company.
Customize Search Layouts
Customize which fields display for users in search results, search filter fields, lookup dialogs, the recent records lists on tab home
pages in Salesforce Classic, and in lookup phone dialogs for Salesforce CRM Call Center.
SEE ALSO:
Page Layouts
Feed-based Layouts Overview
Feed-based page layouts make it easier to work with records by providing two separate views: one for the record’s feed, and one for its
details, including related lists.
Available in: Enterprise, Performance, Unlimited, and Developer Editions
Unlike standard page layouts, which include all of a record’s information—the feed, details, and related lists—on one page, feed-based
layouts let you switch between the feed view and the details view so you can focus on the type of information you need at any given
moment. For example, to see comments others have made about a record or to create a new record that’s related to it, you’d use the
feed view. To delve into the record’s related lists, attachments, and other in-depth information, you’d use the details view.
Feed-based layouts are available on account, asset, case, contact, lead, opportunity, custom, and external objects.
10
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
The feed view in these layouts includes:
1.
Tabs or, if you’re working in the Salesforce console, toggle buttons (
detail view.
) to switch between the feed view and the
2. The publisher, which might include actions that let you do things like create related records or log calls, depending on how your
administrator has set up your organization.
3. The record feed, which shows activity on the record, such as comments others have made about it.
4. Any custom buttons and links your administrator has added.
5.
A follow button (
) or following indicator (
) and a list of people who follow the record. Depending on how your administrator
has set up the page, these might appear on the left side or on the right side.
6. Feed filters, which let you choose which information from the feed you see. Depending on how your administrator has set up the
page, the filters might appear on the left side of the page, in the center, or on the right.
Detail views show in-depth information about the record, including related lists.
11
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
SEE ALSO:
Create Feed-based Page Layouts
Create Page Layouts
With the enhanced page layout editor, you can tailor record page layouts to the needs of your users.
Add, remove, or reorder actions, buttons, fields, and sections on a record’s detail page.
EDITIONS
1. From the management settings for the object that you want to edit, go to Page Layouts.
Available in: both Salesforce
Classic and Lightning
Experience
2. Click New.
3. Optionally, choose an existing page layout to clone.
4. Type a name for the new layout.
5. Optionally, select Feed-Based Layout to create a layout that includes separate tabs for
a record’s feed and detail pages.
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
6. Click Save.
7. Modify the layout.
To create page layouts:
• Customize Application
8. Assign the new layout to user profiles.
12
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Tip: You can also create a new page layout by cloning an existing one using Save As from within the layout.
SEE ALSO:
Edit Page Layouts for Standard Objects
Edit Page Layouts for Custom and External Objects
Control User Access to Fields
Feed-based Layouts Overview
Find Object Management Settings
Create Feed-based Page Layouts
Make it easier for your users to work with account, contact, lead, opportunity, custom, and external
object records by creating feed-based layouts. These layouts include two separate views: one for
the record’s feed and one for its details.
Feed-based layouts offer a more streamlined way of working with records, and don’t require users
to scroll through information they’re not interested in to find what they’re looking for. Users can
easily switch back and forth between the feed view, which includes the publisher and important
events on the record, shown in chronological order, and the details view, which shows in-depth
information about the record, including related lists.
You can create feed-based layouts for account, asset, contact, lead, opportunity, custom, and external
objects. To create feed-based layouts for cases, use Case Feed.
1. Be sure feed tracking is enabled for the object on which you want to create a feed-based layout.
To enable feed tracking, from Setup, enter Feed Tracking in the Quick Find box,
then select Feed Tracking.
2. Create a new page layout and select Feed-Based Layout.
EDITIONS
Available in: Salesforce
Classic
Available in: Group,
Professional, Enterprise,
Performance, Unlimited,
Contact Manager, and
Developer Editions
USER PERMISSIONS
To create, edit, and delete
page layouts:
• Customize Application
Note: Only new page layouts can be feed-based; you can’t change an existing standard
layout to a feed-based layout.
3. Click Edit next to your layout and use the enhanced page layout editor to configure it.
You can’t configure feed-based layouts with the original page layout editor.
4. On the main page layout editor page, customize the publisher to include the actions you want to make available to users, and add
any custom buttons or links.
5. Click Feed View in the page layout editor header to customize what appears on the feed page.
You can:
• Enable full-width feed so the feed expands horizontally when users view records in Salesforce console tabs or subtabs.
• Turn on compact feed so users see a cleaner, more streamlined feed view when working with records in Salesforce console tabs
or subtabs.
• Choose to automatically collapse the publisher when it’s not in use so users can see more of the information below it on the
page.
• Add custom components, which are Visualforce pages with functionality you define.
• Choose where on the page custom buttons and links and standard components like the Follow button and followers list appear.
• Hide the standard sidebar.
13
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
• Choose which feed filters are available, and where they appear.
6. Assign the page layout to user profiles.
SEE ALSO:
Feed-based Layouts Overview
Use Case Feed
Feed Tracking
Enable Feed Updates for Related Records
Page Layouts
Page layouts control the layout and organization of buttons, fields, s-controls, Visualforce, custom
links, and related lists on object record pages. They also help determine which fields are visible,
read only, and required. Use page layouts to customize the content of record pages for your users.
Page layouts can include s-controls and Visualforce pages that are rendered within a field section
when the page displays. You can control the size of the s-controls and Visualforce pages, and
determine whether or not a label and scroll bars display.
Salesforce has two drag-and-drop tools for editing page layouts: the original page layout editor
and an enhanced page layout editor. The enhanced page layout editor is enabled by default, and
provides all the functionality of the original editor, as well as additional functionality and an
easier-to-use WYSIWYG interface.
You can enable the original page layout editor in the User Interface settings. Your Salesforce org
can use only one page layout editor at a time.
From within a page layout, you can access a mini page layout. The mini page layout defines the
hover details that display when you mouse over a field on an object’s detail page in the Agent
console or in the Recent Items section of the sidebar in Salesforce Classic.
For Personal, Contact Manager, Essentials, and Group Edition orgs, every user views the same layout.
Professional, Enterprise, Unlimited, Performance, and Developer Edition orgs can create different
page layouts for use by different profiles and record types and set field-level security settings to
further restrict users’ access to specific fields.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Page layouts are available
in: All Editions
Creation and deletion of
page layouts is available in:
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
To create, edit, and delete
page layouts:
• Customize Application
In Professional, Enterprise, Performance, Unlimited, and Developer Editions, you can set the mini page layouts and related objects that
appear in the Console tab.
Edit Page Layouts for Standard Objects
Change the look and feel of page layouts for standard Salesforce objects.
Edit Page Layouts for Custom and External Objects
Change the look and feel of page layouts for custom and external objects.
Customize Page Layouts with the Enhanced Page Layout Editor
The enhanced page layout editor is a WYSIWYG tool for customizing your page layouts in Salesforce, the Self-Service Portal, and the
Salesforce Customer Portal. The enhanced page layout editor has all the functionality of the original page layout editor, but has more
features and an easier-to-use interface.
14
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Customize Salesforce Classic Home Tab Page Layouts
You can customize the Home tab in Salesforce Classic to include components such as sidebar links, a company logo, a dashboard
snapshot, or custom components that you create. A dashboard snapshot is a clipping of the top row of a dashboard’s components.
Just like other tabs, you can also assign different home page layouts to different users based on profile.
Set Page Layouts and Field-Level Security
Assign Page Layouts to Profiles or Record Types
Assign Page Layouts from a Customize Page Layout or Record Type Page
Edit Multi-Line Layouts for Opportunity Products
Build Page Layouts for Custom Objects
How Page Layouts Work in the Salesforce App
Use the enhanced page layout editor to customize the layout of an object’s record detail pages, configure actions, and adjust which
fields and related lists appear in the Salesforce app.
Page Layouts in Lightning Experience
When you customize your page layouts in Salesforce Classic, those changes can affect the content of object record pages in Lightning
Experience. However, in Lightning Experience, the page elements display differently, and some aren’t supported.
Tips for Optimizing Page Layouts for the Salesforce App
Here are some tips and tricks for making your existing page layouts more mobile-friendly.
Manage Mobile Cards in the Enhanced Page Layout Editor
Add expanded lookups, components, and Visualforce pages to the Mobile Cards section of your page layout to have them show up
as mobile cards in the Salesforce app.
Customize Related Lists
You can customize the buttons, columns displayed, column order, and record sort order of related lists on record detail pages in
Salesforce and the Salesforce Customer Portal.
Customize Detail Page Buttons
Customize Page Layouts with the Original Page Layout Editor
Use the original page layout editor to customize page layouts in Salesforce, the Self-Service Portal, and the Salesforce Customer
Portal.
SEE ALSO:
Control User Access to Fields
15
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Edit Page Layouts for Standard Objects
Change the look and feel of page layouts for standard Salesforce objects.
EDITIONS
From the management settings for the appropriate object, go to Page Layouts.
Alternately, if you’re using the Enhanced Page Layout Editor, which is enabled by default, you can
customize a standard object’s page layout by clicking Edit Layout on the object’s detail page.
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
SEE ALSO:
Page Layouts
USER PERMISSIONS
Control User Access to Fields
Customize Page Layouts with the Original Page Layout Editor
Customize Page Layouts with the Enhanced Page Layout Editor
To customize page layouts:
• Customize Application
To view page layouts:
• View Setup and
Configuration
Edit Page Layouts for Custom and External Objects
Change the look and feel of page layouts for custom and external objects.
1. From the management settings for the object whose page layout you want to edit, go to Page
Layouts.
2. Complete one of the following.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
a. If you have “Customize Application” permission, open the page layout that you want to
customize for edit.
Available in all editions
b. If you have the “View Setup and Configuration” permission, click the page layout that you
want to view.
USER PERMISSIONS
To customize page layouts:
• Customize Application
SEE ALSO:
To view page layouts:
• View Setup and
Configuration
Page Layouts
Control User Access to Fields
Customize Page Layouts with the Original Page Layout Editor
Customize Page Layouts with the Enhanced Page Layout Editor
Find Object Management Settings
16
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Customize Page Layouts with the Enhanced Page Layout Editor
The enhanced page layout editor is a WYSIWYG tool for customizing your page layouts in Salesforce,
the Self-Service Portal, and the Salesforce Customer Portal. The enhanced page layout editor has
all the functionality of the original page layout editor, but has more features and an easier-to-use
interface.
The enhanced page layout editor has two parts: a palette on the upper portion of the screen and
the page layout on the lower portion of the screen. The palette contains the user interface elements
that you can add to your page layout, such as fields, actions, buttons, links, and related lists.
When working with the enhanced page layout editor:
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
• To select multiple elements individually, use Ctrl+click. To select multiple elements as a group,
use Shift+click.
• To change the properties of an element on the page layout, double-click the element or click
the wrench icon ( ) next to it. You can’t change the properties of elements in the palette.
• To make a field read-only or required, double-click the field in the page layout and select the
appropriate checkbox.
To customize page layouts:
• Customize Application
To view page layouts:
• View Setup and
Configuration
• To access the other layouts for an object with multiple page layouts, click the page layout name
at the top of the page and select another layout to view.
• To change the name of the page layout, add personal and public tags if available, and display standard object checkboxes on the
page layout, click Layout Properties.
Note: You can’t rename a page layout if you’re using Salesforce Professional Edition.
• In Enterprise, Unlimited, Performance, and Developer Editions, you can select a profile to preview how the pages will look for users
with that profile. Most related lists’ columns preview without data.
• If you’re working with a feed-based page layout, click Feed View to customize the tools and components that appear when users
are working in the feed on a record.
• To choose which fields display on the record detail page and the order in which they appear, click Edit Multi-Line Layout.
• The mini page layout defines the hover details that display when you mouse over a field on an object’s detail page, in the Agent
console, or in the Recent Items section of the sidebar in Salesforce Classic. To customize the fields in the mini page layout, click Mini
Page Layout at the top of the palette.
• When you’re done customizing the page layout, save it. If you navigate away from your page layout before saving, you lose your
changes.
Note: Changes to user layouts override the global publisher layout on user profile pages and the Chatter home page.
Enhanced Page Layout Editor User Interface Elements
Guidelines for Using the Enhanced Page Layout Editor
Page Layout Tips
Here are a few tips to keep your page layouts organized and easy to use.
17
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Page Layout Considerations
Keep these considerations in mind when working with page layouts in the enhanced page layout editor.
SEE ALSO:
Guidelines for Using the Enhanced Page Layout Editor
Customize Related Lists
Feed-based Layouts Overview
Page Layouts
Enhanced Page Layout Editor User Interface Elements
This list describes the enhanced page layout editor user interface elements and how you can use
them in your page layout. To add elements, drag them from the palette to the layout. Valid drop
locations show up in green. To remove elements, drag them off the layout and back to the palette.
Tip: Create the appropriate buttons, custom links, fields, custom s-controls, and Visualforce
pages before editing your page layout.
Actions
Mobile smart actions appear as a single action element in the page layout editor. However,
they appear in the action bar and action menu in the Salesforce app as distinct create actions.
These distinct actions allow users to create records directly from the action bar. The create
actions included in the set of mobile smart actions vary depending on the page layout’s object.
Note: If you delete an action, the action is removed from all layouts that it’s assigned to.
Wave Analytics Assets
You can add and move an Analytics dashboard to any section on the page layout, except Mobile
Cards.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To customize page layouts:
• Customize Application
To view page layouts:
• View Setup and
Configuration
For an Analytics dashboard element, use field mapping to map data fields in the dashboard to the object’s fields so that the dashboard
shows only the data that’s relevant for the record being viewed. For more about field mapping or filtering Analytics dashboards, see
Embed Analytics Dashboards in Lightning Pages or Embed Analytics Dashboards in Salesforce Classic Pages.
Blank Spaces
You can add and move blank spaces to any section on the page layout, except Mobile Cards. Use blank spaces to visually align and
distinguish elements on the page.
Note: If you use the original page layout editor to view a page layout that was created in the enhanced page layout editor,
the original page layout editor shows the blank spaces that you added. You can’t move or add blank spaces in the original
page layout editor, but you can remove them by dragging them to the box on the right.
Buttons
You can control which standard and custom buttons are displayed and the order in which the custom buttons appear. You can’t
rearrange standard buttons.
Standard and custom buttons are available as actions in the Salesforce app and Lightning Experience.
Canvas Apps
For the Canvas Apps category to appear in the palette, set the canvas app location to Visualforce Page when you create the canvas
app in Salesforce.
• If you add a canvas app to any section other than the Mobile Cards section, the canvas app appears in the page layout in the
full Salesforce site or in the record detail page in the Salesforce app.
18
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
• If you add a canvas app to the Mobile Cards section, the canvas app appears as a card on the record related information page
in the app.
Components
When you add a component to the Mobile Cards section of a page layout, it displays as a card on a record’s related information page
in tne Salesforce app. Components are supported only in the Mobile Cards section of a page layout, and they only appear in the
app.
In organizations that are created after Spring ’14, the Twitter component is added by default to the Mobile Cards section of page
layouts for objects that support it.
Note: Social Accounts and Contacts must be enabled for your organization before you can add the Twitter component to a
page layout.
The Twitter card that you see on account, contact, and lead record pages in Lightning Experience isn’t the same as the Twitter
component available as a mobile card in the page layout editor. The Twitter card in Lightning Experience is a Lightning component.
You must have Social Accounts and Contacts enabled for it to appear.
Expanded Lookups
The Expanded Lookups category for the enhanced page layout editor contains fields with lookup relationships. These fields, when
added to the Mobile Cards section of the layout, display as related lookup cards on a record’s related information page in the Salesforce
app. A page layout can have up to 20 expanded lookups.
The Expanded Lookups category only contains fields with lookup relationships to objects that support compact layouts.
Expanded lookups aren’t supported in Lightning Experience.
Fields
A field can display one or more of these icons:
•
•
The field must have a value to save the record, but isn’t required on the page layout itself.
The field must be included on the page layout because either an administrator configured the field as universally required
or Salesforce automatically requires the field. Although you can’t remove such fields, you can move them to different locations.
•
The field is a controlling field.
•
The field is a dependent field.
•
The field is read only.
To set which fields are required and read only, select one or more fields and click
on any selected field.
• You can’t change the field properties of some standard fields. You can change custom fields only if they aren’t universally required
fields.
• Administrators and users with the Edit Read Only Fields permission can always edit fields marked as read only.
• If you make a picklist field read only, all new records contain the default value for that picklist.
• Auto-number fields are always read only.
• If you mark the opportunity Probability field as read only, the Probability value is still updated when a user changes the Stage
value of an opportunity.
When working with fields:
• In Personal, Contact Manager, and Group Editions, page layouts control which fields users can access in related lists, list views,
reports, Connect Offline, email and mail merge templates, custom links, and when synchronizing data. In Professional, Enterprise,
Unlimited, Performance, and Developer Editions, field-level security controls this access. Field-level security settings override
field properties that you set on the page layout if the field-level security is more restrictive than the page layout setting.
• Users can import values into a field only if they have read and edit access. User permissions, page layout assignments, and
field-level security settings determine field access.
19
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Related Lists
A page layout can have up to 100 related lists. You can place related lists at the bottom of the page layout. To move a related list on
the page layout, drag the handle located above the related list.
To customize a related list, double-click the related list handle or click
inside the handle. Use the related list properties to:
• Specify which fields display as columns on the related list, the order in which they appear, and the sort order of the records in
the related list. In Professional, Enterprise, Unlimited, and Performance Editions, you can also opt to apply the column information
to other page layouts for the same type of object.
• Specify which standard and custom buttons appear on the related list.
When working with related lists on page layouts, note the following:
• The View All button only displays up to 2,000 items in a related list.
• Some related lists aren’t customizable because they link to data rather than store it. Related lists that aren’t customizable are
indicated on the page layout.
• You can’t add related lists to the page layouts for the User object.
• You can enable related list hover links so that record detail pages include links for each related list at the top of the page. Users
can hover over the link to display the corresponding related list in an interactive overlay to view and manage the related list
items. Users can also click the link to jump to the content of the related list without scrolling down the page.
• In Professional, Enterprise, Unlimited, Performance, and Developer Edition, individual users can customize which related lists
display for their personal use. Administrators can overwrite these user customizations and apply the related list configuration in
the page layout to all users, even if they already customized their display. To overwrite users' related list customizations, click
Yes on the Overwrite Users’ Customized Related Lists popup window, which appears when saving a page layout if you moved
or added a related list.
• Related lists show up on the record related information page in the Salesforce app.
Report Charts
Report charts are supported in both Salesforce Classic and Lightning Experience.
Custom S-Controls
A page layout can have up to 20 s-controls.
To change the properties of an s-control, double-click the s-control or click its wrench icon (
) and set the following attributes:
• Width sets the horizontal size in pixels or a percent.
• Height sets the vertical size in pixels.
• Show scrollbars determines whether the iFrame in which the s-control displays contains scroll bars when necessary.
• Show label determines whether the page layout includes the Label of the custom s-control. Remove the label to display the
s-control in a wider area.
S-controls aren’t supported in Lightning Experience.
Sections
You can add and move sections anywhere above the related lists on the page layout. The sections you add can contain fields,
s-controls, and blank spaces. In addition, each page layout has a default section that can only contain custom links and blank spaces.
You can change the location of the custom link section, but you can’t remove it from the page.
The Section user interface element is the second option in the palette when you select the Fields or Custom S-Controls category on
the palette.
To change the attributes of a section, double-click the section or select its associated wrench icon (
• Enter a name for the section. Names of some standard page sections cannot be changed.
• Specify whether the section has one or two columns.
20
). You can:
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
• Specify the order in which users can tab through the items in that section.
• Specify whether the section heading is shown on the detail and edit pages.
Tags
If tags are enabled, click Layout Properties and configure personal and public tags in the header section of the page layout. Users
can’t tag a record if neither personal nor public tags are included in the header section. Also, the positioning of personal and public
tags in the header can’t be modified.
Tags aren’t supported in Lightning Experience.
Visualforce Pages
Visualforce pages can be added to any section on the page layout except for sections reserved for custom links and related lists. A
page layout can have up to 20 Visualforce pages.
You can add a Visualforce page to a page layout only if the standard controller on the Visualforce page is set to the object for which
you are creating the page layout. If you don’t have any Visualforce pages with a standard controller set to that object, the Visualforce
Pages category doesn’t appear in the palette.
Only Visualforce pages with the Available for Lightning Experience, the Salesforce app, and
Lightning Communities checkbox selected will display in the Salesforce app.
Mobile-enabled Visualforce pages show up as slightly differently colored elements in the palette than their non-mobile-enabled
counterparts. Hovering your mouse over a Visualforce page element in the palette shows whether the Visualforce page is
mobile-enabled.
SEE ALSO:
Guidelines for Using the Enhanced Page Layout Editor
Customize Page Layouts with the Enhanced Page Layout Editor
Guidelines for Using the Enhanced Page Layout Editor
• Elements that are already on the page layout still appear on the palette but are inactive. When
you click an inactive element on the palette, Salesforce highlights the element on the page
layout.
• Removing a field from a page layout doesn’t remove it from the object’s compact layout. The
two layout types are independent.
• If the original page layout editor is enabled, users can click the page layout name to access the
detail page of the page layout. The enhanced page layout editor doesn’t have detail pages, as
all the detail page functionality is always available on the enhanced editor. Salesforce displays
a read-only version of the enhanced page layout editor to users with the “View Setup and
Configuration” permission.
Note: The read-only view of the page layout doesn’t display field types and lengths in
hover details.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To customize page layouts:
• Customize Application
To view page layouts:
• View Setup and
Configuration
• The Custom Links, Custom S-Controls, and Visualforce Pages categories only appear in the
palette if you have defined those types of elements for the object for which you are defining a
page layout. When you create a custom link for an object, you add it to the Custom Links section
on that object’s page layout. In non-English Salesforce organizations, the “Custom Links” section title is not translated from English
automatically for the Territory and Territory Model objects, but you can edit the section title.
• The Canvas Apps category appears in the palette only if you defined at least one canvas app with a location of Visualforce Page.
21
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
• The Components category appears in the palette only if the available components are supported by the object for which you are
defining a page layout. For example, the Twitter component is supported only on account, contact, and lead page layouts.
• When editing a person account page layout:
– If you add Shipping Address next to Billing Address in the Address Information section, a link displays on the
person account edit page that allows you to copy the billing address to the shipping address. Also, an equivalent link appears
if you add Other Address to the Address Information section.
– Contact fields and related lists are available on person account page layouts, but contact custom links and custom buttons are
not.
• This table lists standard objects that have checkboxes that are specific to page layouts for that object. To configure how Salesforce
displays the checkboxes, click Layout Properties when customizing the page layout. Use the Select by default checkbox
associated with a checkbox if you want Salesforce to automatically select the option when a user accesses the edit page.
Object
Checkboxes
Account
Evaluate this account against territory rules on save
checkbox — Displays the Evaluate this account against territory
rules on save checkbox on account edit pages.
Territory assignment rules run automatically when the Select by default
checkbox is selected.
If both Show on edit page and Select by default are selected, users
can uncheck the Evaluate this account against territory rules
on save checkbox on the account edit page, and territory assignment rules will not
be run.
Case
– Case assignment checkbox — Displays the Assign using active
assignment rules checkbox on case edit pages.
Case assignment rules run automatically when the Select by default
checkbox is selected.
If both Show on edit page and Select by default are selected, the
assignment checkbox is selected by default, but users can deselect it to override the
assignment rule.
– Email notification checkbox — Displays the Send notification
email to contact checkbox on case edit pages.
Case Close
– Solution information section — Displays the solution information
section on the case close edit pages.
– Notify Contact — Displays the Notify Contact checkbox on case close
edit pages.
Lead
Lead assignment checkbox — Displays the Assign using active
assignment rule checkbox appears on the lead edit page.
Lead assignment rules run automatically when the Select by default checkbox
is selected.
22
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
If both Show on edit page and Select by default are selected, the
assignment checkbox is selected by default, but users can deselect it to override the
assignment rule.
Person Account
Evaluate this account against territory rules on save
checkbox — Displays the Evaluate this account against territory
rules on save checkbox on person account edit pages.
Territory assignment rules run automatically when the Select by default
checkbox is selected.
If both Show on edit page and Select by default are selected, users
can uncheck the Evaluate this account against territory rules
on save checkbox on the account edit page, and territory assignment rules will not
be run.
Task
Email notification checkbox — Displays the Send Notification
Email checkbox appears on the task edit page.
Note: A user’s personal preference for defaulting the state of the checkbox takes
precedence over the organization-wide setting.
SEE ALSO:
Enhanced Page Layout Editor User Interface Elements
Customize Page Layouts with the Enhanced Page Layout Editor
Page Layout Tips
Here are a few tips to keep your page layouts organized and easy to use.
• Use field-level security to restrict users’ access to fields; then use page layouts to organize detail
and edit pages within tabs. This reduces the number of page layouts for you to maintain.
Field-level security settings override the visible and read-only settings on the page layout if the
field-level security has a more restrictive setting than the page layout.
• Remove unnecessary fields.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Page layouts are available
in: All Editions
• Keep the number of required fields to a minimum.
• Group similar fields with sections.
• Think about the right TAB key order for each section.
• Check your layouts in Read and Edit modes.
• Add help and description text to custom fields. Use it to explain to users what data you’re
looking for in the field.
Creation and deletion of
page layouts is available in:
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
• In Professional, Enterprise, Performance, Unlimited, and Developer Editions, use record types
to provide unique layouts for different records.
• Optimize related lists—adjust their overall order, the sorting of the records, and display of relevant columns and buttons.
• If you want to customize the user profile layout in the Salesforce app, create a new layout or edit an existing layout in the User Profile
Page Layouts section.
23
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
• If a dependent lookup is above its controlling field on a page layout, make its lookup filter optional or redesign the page layout.
Placing a required dependent lookup above its controlling field on a page layout could confuse users who typically start from the
top of the page when entering data.
• A background process periodically runs that cleans up metadata associated with deleted custom fields. This process will affect the
Last Modified Date and Last Modified By fields on page layouts, record types, and custom objects.
• Salesforce recommends creating no more than 200 page layouts. Although there is no limit, it can be difficult to manage your page
layouts if you have more than 200.
Page Layout Considerations
Keep these considerations in mind when working with page layouts in the enhanced page layout
editor.
EDITIONS
Page Layouts
Available in: both Salesforce
Classic and Lightning
Experience
• You can’t rename a page layout if you’re using Salesforce Professional Edition.
• You can drag up to 20 s-controls, 20 Visualforce pages, 20 expanded lookups, and 100 related
lists onto a page layout. There are no limits on custom links.
Note: You can’t place a Visualforce page more than once on a page layout.
• In Lightning Experience, page layouts support up to 35 lookup fields. In Salesforce Classic, page
layouts support up to 40 lookup fields.
Page layouts are available
in: All Editions
Creation and deletion of
page layouts is available in:
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
• You can add one Analytics dashboard per page layout.
• Page layouts for the user object only include custom fields, custom links, s-controls, and
Visualforce pages. Tagging, related lists, custom buttons, and standard field customizations are not included on page layouts for the
user object. Also, field-level security is only available for custom fields on the user object. Only standard Chatter actions (Post, File,
Link, Poll, and Thanks) appear on the user profile page, regardless of the actions in the User Page Layout.
• You can edit only certain attributes when you’re working with a page layout that was installed from a managed app. Some changes
that you make to managed page layouts, such as adding components, work when you’re editing the page layout but aren’t reflected
on the record detail page.
• Chatter group layout changes affect the Salesforce app only. Changes to the group publisher (actions and layout) reflect in both the
full Salesforce site and the Salesforce app.
Related Lists
• You can include up to 10 fields per related list.
• In Lightning Experience, only the first four fields on a related list are displayed. Users can click View All to see the rest of the fields.
• You can’t move the first field of a related list, because it’s a unique identifier for the record.
• You can add custom fields of the long text area type to a related list. However, you can’t add some standard fields of the long text
area type. For example, you can’t add the Description field on an Opportunity to a related list.
• The default sort order varies per record. The Sort By drop-down isn’t available for activities and opportunity products.
• Lookup fields aren’t available for display on their corresponding lookup related list. For example, the case lookup field on an account
page layout isn’t available when editing the cases related list.
• You can’t customize the History related list because it links to data stored elsewhere.
24
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Mini Page Layouts
• You can’t choose Mini Console View for the Close Case layout, Log a Case page, or View Cases page layouts on the Self-Service Portal.
You can’t choose Mini Console View for opportunity team page layouts.
• Field properties on the page layout determine field properties on the mini page layout. For example, if a field is read-only on the
page layout, that same field will be read-only on the mini page layout. To change the field properties of fields on the mini page
layout, you must change the field properties of fields on the page layout.
• You can’t define mini page layouts for the Close Case layout, Log a Case page, or View Cases page layouts on the Self-Service Portal.
You can’t define mini page layouts for opportunity team page layouts.
• You can define mini page layouts for the user object; however, you cannot add standard fields or related lists. Also, a customized
mini page layout won’t display in the Agent console.
• Overrides for the Edit and View buttons for an object don’t affect the Edit and View buttons in mini page layouts.
• Fields marked Always Displayed or Always on Layout on page layouts are automatically included on the mini page
layout and cannot be removed unless they are removed from the page layout.
Customize Salesforce Classic Home Tab Page Layouts
You can customize the Home tab in Salesforce Classic to include components such as sidebar links,
a company logo, a dashboard snapshot, or custom components that you create. A dashboard
snapshot is a clipping of the top row of a dashboard’s components. Just like other tabs, you can
also assign different home page layouts to different users based on profile.
EDITIONS
You can add components to the sidebar or the main panel. You can also determine if custom sidebar
components appear only on the Home tab or on all Salesforce pages.
Available in all editions
Available in: Salesforce
Classic
USER PERMISSIONS
Create Custom Home Page Components
Use custom components to configure the Salesforce Classic home page for your users. Add
HTML, images, links, and more to enhance your users’ productivity.
Design Home Page Layouts in Salesforce Classic
After creating the components you want displayed on the Home tab, design your home page
layouts. You can design your layouts based on your unique organizational and user needs.
To view home page layouts:
• Customize Application
To create or change home
page layouts:
• Customize Application
Visualforce Area Home Page Components
Use Visualforce Area home page components to add dynamic content to your home page. For example, you can present content
from partner apps, display charts with the Reports and Dashboards REST API, or add a canvas app to the home page.
Home Page Components Tips and Considerations
Keep these considerations in mind when creating custom components that you want displayed on the Salesforce Classic Home tab.
Assign Home Tab Page Layouts to Profiles
Your home page layouts are only visible to users after you assign them to a user profile.
25
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Create Custom Home Page Components
Use custom components to configure the Salesforce Classic home page for your users. Add HTML,
images, links, and more to enhance your users’ productivity.
EDITIONS
Before you begin:
Available in: Salesforce
Classic
• If you’re creating custom link components, define your Home tab custom links first. See Custom
Buttons and Links on page 960.
Available in all editions
• If you’re creating an image component, upload your image to the Documents tab first.
• If you’re creating a Visualforce Area component, create your Visualforce page first.
USER PERMISSIONS
1. From Setup, enter Home Page Components in the Quick Find box, then select
Home Page Components.
To create or change home
page layouts:
• Customize Application
2. Click New.
3. Enter a name for the component. For custom links, this name is displayed as the section heading
in the sidebar on the Home tab.
4. Choose the type of component.
5. Click Next, and then complete one or more of these steps.
• For links, select the appropriate custom links, and then click Add.
• For images, click Insert an image, choose the document folder, and then select the image file. The image file must be in a public
folder and Externally Available must be enabled on the document’s properties so that users can view the image.
Tip: Keep your image size smaller than 20 KB for optimum performance.
• For an HTML Area component, choose where to display it—in the wide or narrow column—and then enter your content in the
box below.
Note: HTML Area home page components don’t support JavaScript, CSS, iframes, and some other advanced markup. To
use JavaScript or other advanced HTML elements in your home page component, we recommend that you use a Visualforce
Area component instead.
• For a Visualforce Area component, choose where to display it—in the wide or narrow column—then select the Visualforce page,
and assign it a height.
6. Click Save.
After creating the home page component, you need to add it to a home page layout. See Design Home Page Layouts in Salesforce
Classic on page 27.
Note: Components in the narrow column are displayed in the sidebar. They aren’t displayed in the sidebar on other pages in
Salesforce unless you specify that in your user interface settings or by assigning the “Show Custom Sidebar On All Pages” permission.
SEE ALSO:
Visualforce Area Home Page Components
Home Page Components Tips and Considerations
26
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Design Home Page Layouts in Salesforce Classic
After creating the components you want displayed on the Home tab, design your home page
layouts. You can design your layouts based on your unique organizational and user needs.
EDITIONS
1. From Setup, enter Home Page Layouts in the Quick Find box, then select Home
Page Layouts.
Available in: Salesforce
Classic
2. Click to edit an existing layout or create one. Alternately, select a layout to copy and click Clone.
Available in all editions
3. If you create a layout, give it a name and then click Save.
USER PERMISSIONS
4. Select the components to display on the layout.
• To add the Find Articles component, select Article Search. This component is only available
for Salesforce Knowledge users.
• To add the Customer Portal component, select Customer Portal Welcome. If the My
Profile site Visualforce page has been enabled, this component contains a personalized
welcome message and a link to the portal user’s profile. The My Profile page enables users
logged into either your Force.com site, or your Customer Portal from Force.com sites, to
update their own contact information. When they make changes to this page, the
corresponding portal user and contact records are updated.
To view home page layouts:
• View Setup and
Configuration
To create or change home
page layouts:
• Customize Application
• To allow your users to resume flow interviews that they’ve paused, select Paused Flow Interviews. This component displays
only flow interviews that the user has paused.
Note: You can add up to 20 components to a home page layout.
5. Click Next.
6. Customize the order in which the narrow and wide components appear. Move a component by selecting it and using the arrow
buttons.
7. Click Save.
SEE ALSO:
Assign Home Tab Page Layouts to Profiles
Customize Salesforce Classic Home Tab Page Layouts
Visualforce Area Home Page Components
Use Visualforce Area home page components to add dynamic content to your home page. For
example, you can present content from partner apps, display charts with the Reports and Dashboards
REST API, or add a canvas app to the home page.
The Visualforce page that you choose for the component can use a standard or custom controller.
You can include JavaScript in your Visualforce page, but because the component is rendered in an
iframe on the home page layout, the JavaScript can’t interact with the page that contains the
component.
EDITIONS
Available in: Salesforce
Classic
Available in all editions
Sample Usage
If your Visualforce Area home page component displays in the sidebar, you can dynamically get the record ID and top-level URL of the
page that the component is being displayed on by using the $CurrentPage global variable in your Visualforce markup.
27
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Using $CurrentPage, you can access the query string parameters for the page by specifying the parameters attribute, after
which you can access each individual parameter:
$CurrentPage.parameters.parameter_name
The parameters for record ID and top-level page URL are, respectively, id and sfdcIFrameOrigin. For more information, see
“Getting Query String Parameters” in the Visualforce Developer's Guide.
Home Page Components Tips and Considerations
Keep these considerations in mind when creating custom components that you want displayed
on the Salesforce Classic Home tab.
EDITIONS
• Standard components without an Edit link are read only.
Available in: Salesforce
Classic
• The components that you select for the narrow column display in the sidebar. They don’t display
in the sidebar on other pages within Salesforce unless you specify that in your user interface
settings. If you only want certain users to view sidebar components on all pages, grant those
users the “Show Custom Sidebar On All Pages” permission.
Available in all editions
• When editing the standard Messages & Alerts component, enter the text that you want to display to users. If entering HTML code
for your message, make sure that it’s self-contained, well-formed HTML.
Note: Standard Messages & Alerts home page components don’t support JavaScript, CSS, iframes, and some other advanced
markup.
• When editing the standard Custom Links home page component, enter the link text to display to users in the Bookmark field. In
the URL field, enter the complete website address, such as http://www.yahoo.com. To link to a Salesforce page, enter only
the part of the URL after salesforce.com, for example, /00Ox0000000esq4. These links always open within the main
Salesforce window, not in a popup window.
• The standard Custom Links home page component is a quick way to add links to the sidebar, but it doesn’t support merge fields,
functions (such as URLFOR), executing JavaScript, or customizable window opening properties. If you need this additional functionality:
1. From Setup, enter Home in the Quick Find box, then select Custom Links, and then create your home page custom links
on that page.
2. From Setup, enter Home in the Quick Find box, then select Home Page Components, and then create a custom home
page component of type Links on that page that includes the custom links that you created in the first step. Creating a custom
home page component for your links doesn’t change the visual styling for your end users.
• The Dashboard Snapshot component displays the top three components of the last dashboard the user accessed. Users can
view a dashboard snapshot on their Home tab if they have access to at least one dashboard.
• When designing home page layouts for your Customer Portal, we recommend adding the following components: Search, Solution
Search, Recent Items, Customer Portal Welcome, and a custom HTML Area component that includes your corporate branding in the
wide column.
• You can add up to 20 components to a home page layout.
SEE ALSO:
Create Custom Home Page Components
28
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Assign Home Tab Page Layouts to Profiles
Your home page layouts are only visible to users after you assign them to a user profile.
1. From Setup, enter Home Page Layouts in the Quick Find box, then select Home
Page Layouts.
2. Click Page Layout Assignment.
EDITIONS
Available in: Salesforce
Classic
Available in all editions
3. Click Edit Assignment.
4. Choose the appropriate page layout for each profile.
Initially, all users, including Customer Portal users, are assigned to the Home Page Default layout.
5. Click Save.
Tip: Users can customize the dashboard settings on their Home tab in their personal settings.
USER PERMISSIONS
To assign home page
layouts:
• Customize Application
Set Page Layouts and Field-Level Security
Use field-level security as the means to restrict users’ access to fields; then use page layouts primarily
to organize detail and edit pages within tabs. This reduces the number of page layouts for you to
maintain. For example, if a field is required in the page layout and read only in the field-level security
settings, the field-level security overrides the page layout and the field will be read only for the user.
Note: Field-level security doesn’t prevent searching on the values in a field. When search
terms match on field values protected by field-level security, the associated records are
returned in the search results without the protected fields and their values.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Page layouts and search
layouts available in: All
Editions
Field-level security available
in: Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
For Personal, Contact Manager, and Group Editions
1. Create custom fields.
2. Create any custom buttons or links.
3. Create any custom s-controls.
4. Define page layouts. All users automatically use the same page layout for each object.
5. Set the related objects and the mini page layouts that display in the console.
6. Define search layouts. All users use the same search layouts.
For Professional, Enterprise, Unlimited, Performance, and Developer Editions
1. Create custom fields.
2. Create any custom buttons or links.
3. Create any custom s-controls.
4. Create any custom profiles.
5. Create record types for different business scenarios.
6. Assign which record types are available to users with different profiles.
7. Set the field-level security for each profile to restrict users’ access to specific fields.
8. Define page layouts to organize your pages.
9. Set the related objects and the mini page layouts that display in the console.
29
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
10. Assign page layouts to users based on profiles and record types.
11. Check the field accessibility grid to verify that all field access settings are correct.
12. Define search layouts. All users use the same search layouts.
Tip: Click Preview while editing a page layout to see how the page will look for users with different profiles. This preview includes
any extra security that is set in field-level security.
Assign Page Layouts to Profiles or Record Types
After defining page layouts, assign which page layouts users see. A user’s profile determines which
page layout he or she sees. In addition, if your organization is using record types for a particular
object, the combination of the user’s profile and the record type determine which page layout is
displayed when a user views records for that object.
You can assign page layouts from:
• The object's customize page layout or record type page
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
• The original or enhanced profile user interface.
Page layouts are available
in: All Editions
To verify that users have the correct access to fields based on the page layout and field-level security,
you can check the field accessibility grid. From Setup, enter Field Accessibility in the
Quick Find box, then select Field Accessibility. From this page, choose a particular object to view
and then select whether you want to check access by profiles, record types, or fields.
Record types are available
in: Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
SEE ALSO:
Page Layouts
Assign Page Layouts in the Original Profile User Interface
Assign Record Types and Page Layouts in the Enhanced Profile User Interface
Tailor Business Processes to Different Users
Control User Access to Fields
30
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Assign Page Layouts from a Customize Page Layout or Record Type Page
1. From the management settings for the appropriate object, go to Page Layouts or Record Types.
EDITIONS
2. Click Page Layout Assignment.
3. Click Edit Assignment.
4. Use the table to specify the page layout for each profile. The table displays the page layout
assignments for each profile. If your organization uses record types, a matrix displays a page
layout selector for each profile and record type.
When selecting page layout assignments:
• Click a cell, column, or row heading to select all the table cells in that column or row.
• Press SHIFT+click to select multiple adjacent table cells, columns, or rows.
• Press CTRL+click to select multiple nonadjacent table cells, columns, or rows.
Available in: Salesforce
Classic and Lightning
Experience
Page layouts are available
in: All Editions
Record types are available
in: Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
• Click any cell and drag to select a range of cells.
• Click Next or Prev to view another set of record types.
USER PERMISSIONS
Selected page layout assignments are highlighted. Page layout assignments you change are
italicized until you save your changes.
To assign page layouts:
• Manage Profiles and
Permission Sets
5. If necessary, select another page layout to assign from the Page Layout To Use
drop-down list and repeat the previous step for the new page layout.
6. Click Save.
SEE ALSO:
Assign Page Layouts to Profiles or Record Types
Edit Multi-Line Layouts for Opportunity Products
You can customize the columns that display when you click Edit All in the Products related list of
an opportunity detail page.
EDITIONS
1. From the object management settings for opportunity products, go to Page Layouts.
Available in: both Salesforce
Classic and Lightning
Experience
2. Next to the name of an opportunity product page layout, click Edit.
3. Click Edit Multi-Line Layout.
4. Move fields between Available Fields and Selected Fields.
• To customize which fields display in the layout, select one or more fields in Available Fields
and click Add or Remove.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• To sort fields in the layout, select one or more fields in Selected Fields and click Up or Down.
• To select multiple fields individually, use CTRL+click.
USER PERMISSIONS
• To select multiple fields as a group, use SHIFT+click.
To edit multi-line layouts for
opportunity products:
• Customize Application
5. Click Save to apply your changes.
31
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Build Page Layouts for Custom Objects
Page layouts define which fields users can view and edit when entering data for a custom object
record. You can use the default page layout that is created automatically when you create a custom
object. You can also build your own page layout with related lists and custom links. If you do not
use any page layout with your custom object, you can still interact with it by using the Force.com
API to manage custom data or build a custom user interface.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
To define page layouts for
custom objects:
• Customize Application
1. From the object management settings for a custom object, go to Page Layouts.
2. In the Page Layouts related list, open an existing page layout for edit, or create a new page layout.
3. If creating a new page layout, enter a name for it, and select an existing page layout to clone, if desired.
4. Edit the page layout just as you would any other page layout.
5. Click Save.
SEE ALSO:
Page Layouts
Find Object Management Settings
32
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
How Page Layouts Work in the Salesforce App
Use the enhanced page layout editor to customize the layout of an object’s record detail pages,
configure actions, and adjust which fields and related lists appear in the Salesforce app.
EDITIONS
In the Salesforce app, page layouts drive these areas of the mobile experience.
Available in: both Salesforce
Classic and Lightning
Experience
Record Related Information and Detail Pages
When you view a record in the app, you see the fields, Visualforce pages, and related lists that
are based on the record type and the user’s profile. Related lists show up as single-line cards
containing the name of the page or related list. Tapping the related list card displays its details.
Available in: All editions
except Database.com
Mobile Cards
You can add expanded lookups, components, canvas apps, and Visualforce pages to the Mobile
Cards section of your page layout to have them show up as mobile cards in the app. The elements you place in this section don’t
show up on a record’s detail page in the full Salesforce site. They appear only on the record’s related information page in the app.
Note: In organizations that are created after Spring ’14, the Twitter component is added by default to the Mobile Cards section
of page layouts for objects that support it.
Actions
Actions in the Salesforce Mobile and Lightning Experience Actions section of a page layout appear in the action bar and action menu
on the object’s record pages.
Here are the record detail page, related information page, and action menu for a sample account, Edge Communications:
33
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Page Layouts in Lightning Experience
When you customize your page layouts in Salesforce Classic, those changes can affect the content
of object record pages in Lightning Experience. However, in Lightning Experience, the page elements
display differently, and some aren’t supported.
If you’re in an org that supports multiple page layouts, you can create a page layout directly from
the Page Layouts related list on any object in the Object Manager. You can also edit or delete an
object’s page layouts by clicking
on a page layout in the Page Layouts related list.
Here’s a sample contact record in Lightning Experience. The highlights panel contains key fields
for the record, and is the only part of a record page that you can’t customize using the page layout
editor. The fields in the highlights panel are customized using a compact layout.
EDITIONS
Available in: Lightning
Experience
Page layouts are available
in: All Editions
Creation and deletion of
page layouts is available in:
Enterprise, Performance,
Unlimited, and Developer
Editions
These page layout elements are supported in Lightning Experience.
Actions
Actions display in different places, such as the highlights panel, Activity tab, and the Collaborate tab. The actions are derived from
the list of actions in the Salesforce Mobile and Lightning Experience Actions section of the page layout. Some actions aren’t supported
in Lightning Experience.
For more information, see Actions in Lightning Experience on page 940.
Blank Spaces
Blank spaces are supported in Lightning Experience.
Canvas Apps
Canvas apps are supported in Lightning Experience.
Custom Links
Custom links display under the Details tab.
Fields
Fields display under the Details tab. You can remove or reorder fields on a page layout only via the page layout editor.
34
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Related Lists
Related lists are included as Lightning components in Lightning Experience. Not all related lists are supported in Lightning Experience.
In Lightning Experience, only the first four fields on a related list are displayed. Users can click View All to see the rest of the fields.
Report Charts
Report charts that you add to a page layout appear under the Details tab in Lightning Experience. When you add a report chart to
a page layout, it can take a few moments before the chart appears on Lightning record pages.
Sections
Sections appear along with fields under the Details tab. A section with no header is incorporated into the section above it.
Standard and Custom Buttons
Standard and custom buttons are treated as actions in Lightning Experience, just like in the Salesforce app.
Important: Custom buttons that call JavaScript aren’t supported in Lightning Experience.
Visualforce Pages
Visualforce pages that you’ve added to the page layout appear under the Details tab. Only Visualforce pages with Available for
Salesforce mobile apps and Lightning pages enabled display in Lightning Experience.
Visualforce pages that have been put into the Mobile Cards section as components don’t appear in Lightning Experience.
These page layout elements aren’t supported in Lightning Experience.
• Expanded lookups
• Mobile cards
Note: The Twitter card that you see on account, contact, and lead record pages in Lightning Experience isn’t the same as the
Twitter component available as a mobile card in the page layout editor. The Twitter card in Lightning Experience is a Lightning
component. You must have Social Accounts and Contacts enabled for it to appear.
• S-controls
• Tags
Note: You can’t use the enhanced page layout editor to customize the layout of Lightning Experience record home pages.
SEE ALSO:
Add Send an Email, Log a Call, New Event, and New Task Buttons to the Activity Composer
Tips for Optimizing Page Layouts for the Salesforce App
Here are some tips and tricks for making your existing page layouts more mobile-friendly.
Page layouts containing dozens of fields and lots of related lists might be manageable when viewing
records on a computer screen, but on a small mobile device, viewing that same record can be
overwhelming. People accessing information using a mobile device are looking for a quick way to
get what they need, and making your users sift through hundreds of fields and related lists just
doesn’t make sense.
When optimizing a page layout, consider:
• What are the important things to see at a glance?
• What are the important moments for your users when they’re working in the Salesforce app?
• What actions or processes can you automate so that your users don’t have to manually do them?
35
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All editions
except Database.com
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
The Key: Organize and Minimize Fields
• Use sections to organize information logically, putting the most important things at the top of the page so they show up first. Your
users don’t want to search for fields individually. Organizing similar fields in sections will help your users find what they need. They
can then easily scroll down the page to the section they care about.
• For accounts, contacts, and leads, you don’t need to put phone or email fields near the top. They’re already quickly accessible via
the
and
icons on each record page’s action bar.
• You don’t need to keep fields in one column, as the page will render dynamically based on the device that’s viewing it. A phone will
reorder the fields into a single column, and a tablet or desktop will show two columns.
• Put the most important fields into the compact layout—which drives record highlights and record preview cards in the Salesforce
app—so they’re available right up front, and so your mobile users don’t have to drill into the record detail. We’ll get into compact
layouts in more detail soon.
• Keep the number of required fields to a minimum. Setting a field to required means it must appear on the detail page of all page
layouts, so consider whether each field is truly required. You might have to convince stakeholders that a field isn’t actually necessary
for a record to be saved.
• If available in your organization, think about using record types so that fields that aren’t common to all records don’t have to appear
on all records.
• To reduce the number of fields on a screen, consider using default values for new records instead of having the user enter the data.
Manage Mobile Cards in the Enhanced Page Layout Editor
Add expanded lookups, components, and Visualforce pages to the Mobile Cards section of your
page layout to have them show up as mobile cards in the Salesforce app.
EDITIONS
The items you place in the Mobile Cards section don’t show up on a record’s detail page in the full
Salesforce site but only on the record’s related information page in the app.
Available in: both Salesforce
Classic and Lightning
Experience
You can add these types of elements to the Mobile Cards section of a page layout.
Available in: All editions
except Database.com
• Components
• Expanded lookups
• Visualforce pages
USER PERMISSIONS
• Canvas apps
Some standard objects have mobile cards that are added for you by default. Customize the page
layout to remove them or add additional cards.
To customize page layouts:
• Customize Application
1. Access the page layout editor.
To view page layouts:
• View Setup and
Configuration
2. From the Expanded Lookups, Components, Visualforce Pages, or Canvas Apps categories, drag
an element into the Mobile Cards section.
3. Save the page layout.
After saving the layout, the items you added show up immediately in the app. You may need to refresh to see the changes.
36
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Customize Related Lists
You can customize the buttons, columns displayed, column order, and record sort order of related
lists on record detail pages in Salesforce and the Salesforce Customer Portal.
EDITIONS
1. Access the page layout editor.
Available in: both Salesforce
Classic and Lightning
Experience
2. To edit a related list, double-click it. If you’re using the enhanced page layout editor, you can
also click the wrench icon ( ).
Note: You can’t customize the History related list because it links to data stored elsewhere.
3. Select which fields to include in the related list, and define the order in which the fields display.
You can include up to 10 fields per related list.
4. If desired, select other page layouts to apply your related list customizations to.
Only layouts that include this related list appear in the list. Layouts that include related lists with
the same customizations as the current layout had when you opened it are selected by default.
Available in: All Editions
except Database.com
USER PERMISSIONS
To customize related lists:
• Customize Application
5. Click + in the Buttons section to customize which standard and custom buttons are displayed in the related list.
Note: The custom button must be defined for the object contained in the related list, not the parent object, and the button
Type must be List Button. For example, to display a custom button on the Contacts related list of an account, define the
custom button for contacts, not accounts.
6. If necessary, click Revert to Defaults to undo any customizations and use the default Salesforce settings in the related list.
7. Click OK to store your customizations. Changes aren’t saved until you save the page layout.
8. Select Overwrite users’ customized related lists to apply the related lists in the page layout to all users, even
if they have already customized their display.
9. Save the page layout.
Note: You can enable related list hover links so that record detail pages include links for each related list at the top of the page.
Users can hover the mouse over a related list hover link to display the corresponding related list in an interactive overlay that allows
users to quickly view and manage the related list items. Users can also click a related list hover link to jump to the content of the
related list without scrolling down the page.
SEE ALSO:
Control User Access to Fields
37
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Customize Detail Page Buttons
When customizing page layouts, you can control which standard and custom buttons are displayed
and the order in which the custom buttons are shown. To customize the buttons on record detail
pages:
EDITIONS
1. From the management settings for the object whose page layout you want to customize, go
to Page Layouts.
Available in: both Salesforce
Classic and Lightning
Experience
2. Click Edit next to the page layout you want to customize.
Available in all editions
3. Do one of the following.
• In the original page layout editor, double-click the Detail Page Buttons item in the Button
Section.
– To hide any standard button, deselect the checkbox next to the button name.
– To add or remove a custom button, select the button in the Available Buttons list, and
click Add or Remove.
USER PERMISSIONS
To customize detail page
buttons:
• Customize Application
– Sort custom buttons by selecting them and clicking Up or Down.
– To undo your customizations and restore default settings, click Revert to Defaults.
– Click OK to close the popup when you are done.
• In the enhanced page layout editor, select the Buttons category on the palette and drag one or more buttons from the palette
to the buttons section on the page layout. Standard buttons must go in the standard buttons area, and custom buttons must
go in the custom buttons area. To remove a standard or custom button from the page layout, drag the button to the palette.
4. Click Save on the page layout.
5. Click Save.
SEE ALSO:
Override Standard Buttons and Tab Home Pages
Define Custom Buttons and Links
Find Object Management Settings
Customize Page Layouts with the Original Page Layout Editor
Use the original page layout editor to customize page layouts in Salesforce, the Self-Service Portal,
and the Salesforce Customer Portal.
Note: We recommend using the enhanced page layout editor instead of the original page
layout editor because it offers more features and an easier-to-use interface.
EDITIONS
Available in: Salesforce
Classic
Available in all editions
1. Access the page layout editor.
• Edit Page Layouts for Standard Objects
USER PERMISSIONS
• Edit Page Layouts for Custom and External Objects
2. If tags are enabled, specify whether personal and public tags should be included in the header
section of the page layout. Users can tag a record only if personal or public tags are included
here.
38
To customize page layouts:
• Customize Application
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
• To add personal or public tags, select Header Items from the View dropdown list and then drag the Personal Tags or Public
Tags items to the header section. You can’t change the order in which personal and public tags appear when both are in the
header section at the same time.
• To remove tags, drag the Personal Tags and Public Tags items from the header section to the area under the View dropdown
list.
3. To customize buttons, double-click Detail Page Buttons in the Button section.
4. To arrange fields, custom s-controls, Visualforce pages, custom links, and related lists on the layout, select one or more items from
the box on the right and drag them to the desired location. You can drag up to 20 s-controls, 20 Visualforce pages, 20 expanded
lookups, and 100 related lists onto a page layout. There are no limits on custom links.
Note: You can add a Visualforce page to a page layout only if the standard controller on the Visualforce page is set to the
object for which you are creating the page layout. If you don’t have any Visualforce pages with a standard controller set to
that object, the Visualforce Pages category doesn’t appear in the palette.
5. To set which fields are required and read only, select one or more fields and click Edit Properties.
• You can change custom fields only if they are not universally required fields.
• Fields marked as read only are always editable by administrators and users with the Edit Read Only Fields permission.
• If you make a picklist field read only, all new records contain the default value for that picklist.
• Auto-number fields are always read only.
• If you make the opportunity Probability field read only, the Probability value still updates automatically when a user changes
the Stage value of an opportunity.
• In Professional, Enterprise, Unlimited, Performance, and Developer Editions, field-level security settings override the field properties
you set here if the field-level security is more restrictive than the page layout setting.
6. To change the properties of an s-control or Visualforce page, double-click it and set the following attributes.
• Width sets the horizontal size in pixels or a percent.
• Height sets the vertical size in pixels.
• Show scrollbars determines whether the iFrame in which the s-control displays contains scrollbars when necessary.
• Show label determines whether the page layout includes the label of the custom s-control. Remove the label to display the
custom s-control in a wider area.
7. To organize the page using sections, click Edit next to an existing page section, or click Create New Section.
8. To customize related lists on the page layout, double-click a related list in the Related List section.
Some related lists aren’t customizable because they link to data rather than store it. You can move your cursor over any related list
section to see if it is customizable. Also, lookup fields are not available for display on their corresponding lookup related list. For
example, the case lookup field on an account page layout is not available when editing the cases related list.
Note: You can enable related list hover links so that record detail pages include links for each related list at the top of the
page. Users can hover the mouse over a related list hover link to display the corresponding related list in an interactive overlay
that allows users to quickly view and manage the related list items. Users can also click a related list hover link to jump to the
content of the related list without scrolling down the page.
9. To apply the related lists in the page layout to all users, even if they have already customized their display, select Overwrite users’
customized related lists.
10. To review the page layout, click Preview. From the preview in Enterprise, Unlimited, Performance, and Developer Editions, select a
profile to see how the pages will look for users with different profiles. Most related lists’ columns preview without data.
39
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
11. Click Save to finish. Alternatively, click Quick Save to save and continue editing the page layout.
In Professional, Enterprise, Unlimited, Performance, and Developer Editions:
• To choose which related records display in the Console tab’s mini view, click Mini Console View.
• To define the mini page layouts of the records that appear in the Console tab’s mini view, click Mini Page Layout.
Note: You can’t define mini console views or mini page layouts for the Close Case Layout or the Log a Case Page and View Cases
Page layouts on the Self-Service Portal.
In Enterprise, Unlimited, Performance, and Developer Editions:
• You can assign page layouts for different profile and record type combinations.
• You can set field-level security to restrict field access further.
Notes on Using the Original Page Layout Editor
SEE ALSO:
Notes on Using the Original Page Layout Editor
Customize Related Lists
Page Layouts
Notes on Using the Original Page Layout Editor
• When customizing page layouts for tasks, you can select the following checkboxes. (These
options are unavailable when user control over task assignment notifications is enabled.)
EDITIONS
– Show Task Email Notification checkbox displays the Send
Notification Email checkbox when users create or edit a task.
Available in: Salesforce
Classic
– Select Task Email Notification checkbox by default selects the
Send Notification Email checkbox by default when users create or edit a task.
Note that a user's personal preference for defaulting the state of the checkbox takes
precedence over the organization-wide setting.
Available in all editions
• When customizing page layouts for cases, you can select the following checkboxes. (These options are unavailable when user control
over task assignment notifications is enabled.)
– Show on edit page Case Assignment checkbox displays the Assign using active assignment
rules checkbox when users create or edit a case.
– Default Case Assignment checkbox automatically runs case assignment rules.
If both Show on edit page and Select by default are selected, the assignment checkbox is selected by default,
but users can deselect it to override the assignment rule.
– Show Case Email Notification checkbox displays the Send Notification Email checkbox when
users create or edit a case.
– Select Case Email Notification checkbox by default selects the Send Notification Email
checkbox by default when users create or edit a case.
• Page layouts for the user object only include custom fields, custom links, s-controls, and Visualforce pages. Tagging, related lists,
custom buttons, and standard field customizations are not included on page layouts for the user object. Also, field-level security is
available only for custom fields on the user object.
40
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
• You can define mini page layouts for the user object; however, you cannot add standard fields or related lists. Also, a customized
mini page layout won’t display in the Agent console.
• Users can import values into a field only if they have read and edit access. User permissions, page layout assignments, and field-level
security settings determine field access.
• In Personal, Contact Manager, and Group Editions, page layouts control which fields users can access in related lists, list views, reports,
Connect Offline, email and mail merge templates, custom links, and when synchronizing data. In Professional, Enterprise, Unlimited,
Performance, and Developer Editions, this access is controlled by field-level security.
• In Professional, Enterprise, Unlimited, Performance, and Developer Edition, individual users can customize which tabs and related
lists display for their personal use.
• When editing a person account page layout, if you add Shipping Address next to Billing Address in the Address
Information section, a link will display on the person account edit page that allows you to copy the billing address to the shipping
address. Also, an equivalent link appears if you add Other Address to the Address Information section.
• Some items can only be moved to certain sections on the page layout. For example, you can drag a custom s-control to any field
section on the page layout but not a related list section or button section.
• Create the appropriate buttons before editing your page layout. For example, create an account custom button for the detail page
and a contact custom list button before putting them both on an account page layout.
• If you use the original page layout editor to view a page layout that was created in the new page layout editor, the original page
layout editor will show any blank spaces you added. You cannot move or add blank spaces in the original page layout editor, but
you can remove them by dragging them to the box on the right.
SEE ALSO:
Customize Page Layouts with the Original Page Layout Editor
Compact Layouts
A compact layout displays a record’s key fields at a glance in both the Salesforce app and Lightning
Experience.
EDITIONS
In the Salesforce app, the first four fields that you assign to a compact layout appear in:
Available in: Salesforce
Classic and Lightning
Experience
• An object’s record highlights area
• Expanded lookup cards on a record’s related information page
In Lightning Experience, the first six fields that you add to a compact layout appear in an object’s
record highlights panel and in the expanded lookup card you see when you hover over a link in
record details. The field you put first displays at the top in bold.
41
Available in: All editions
except Database.com
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
As with page layouts, there are separate compact layouts for each object. By default, each object derives its record highlight fields,
preview cards, and action-related feed items from the predefined set of fields in the object’s read-only, system default compact layout.
You can create custom compact layouts on an object-by-object basis. After you create one or more custom compact layouts, you set
one as the primary compact layout for the object. The primary compact layout is then used as the new default for that object.
If you have record types associated with an object, you can override the object’s primary compact layout and assign different compact
layouts to some or all of the record types. Each record type can have only one compact layout assigned to it.
Event and task compact layouts determine the fields that show up in the details section when you expand an activity in the activity
timeline in Lightning Experience. When you change the compact layout for tasks in the activity timeline, you also impact the fields that
show up in the highlights area on tasks, in tasks lists, and everywhere else the compact layout is used.
Compact layouts support all field types except:
• text area
• long text area
• rich text area
• multi-select picklist
These limitations apply to Chatter:
• In the full Salesforce site, a compact layout determines which fields appear in the Chatter feed item that appears after a user creates
a record with a quick action.
42
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
• To avoid inadvertent sharing of information through the feed, the Task page layout determines the fields displayed in the Chatter
feed items for tasks created using a quick action.
• Primary compact layouts determine which fields are shown in Chatter personal digest emails.
Create Compact Layouts
Use compact layouts to customize the fields that display for object records when viewed in the Salesforce app and Lightning
Experience.
Assign Compact Layouts to Record Types
As with page layouts, there are separate compact layouts for each object. By default, each object derives its record highlight fields,
preview cards, and action-related feed items from the predefined set of fields in the object’s read-only, system default compact
layout. You can create custom compact layouts on an object-by-object basis. After you create one or more custom compact layouts,
you set one as the primary compact layout for the object. The primary compact layout is then used as the new default for that object.
Notes on Compact Layouts
Keep these considerations in mind when using compact layouts.
SEE ALSO:
Activity Timeline
Create Compact Layouts
Use compact layouts to customize the fields that display for object records when viewed in the
Salesforce app and Lightning Experience.
EDITIONS
The first four fields on your compact layout populate the record highlights section at the top of
each record view in the Salesforce app. The record highlights section in Lightning Experience uses
the first six fields on the compact layout.
Available in: both Salesforce
Classic and Lightning
Experience
1. From the management settings for the object that you want to edit, go to Compact Layouts.
Available in: All editions
except Database.com
2. Create a new compact layout and give it a label.
3. Add up to 10 fields.
USER PERMISSIONS
Tip: Put the object’s Name field first to provide context for your users when they view
a record.
4. Sort the fields by selecting them and clicking Up or Down.
The order you assign to the fields determines the order in which they display.
5. Save the layout.
To customize compact
layouts:
• Customize Application
To view compact layouts:
• View Setup and
Configuration
6. To set the compact layout as the primary compact layout for the object, click Compact Layout
Assignment.
Example: Here’s a sample compact layout edit page for the Account object. It shows the name of the layout and a list of fields
to display.
43
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Here’s the related page for the same account object in Lightning Experience. You can see the account’s name, phone number,
type, industry, rating, and account owner at the top of the page.
And here’s what that same account record looks like in the app.
44
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
SEE ALSO:
Customize Case Hovers in Lightning Experience
45
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Assign Compact Layouts to Record Types
As with page layouts, there are separate compact layouts for each object. By default, each object
derives its record highlight fields, preview cards, and action-related feed items from the predefined
set of fields in the object’s read-only, system default compact layout. You can create custom compact
layouts on an object-by-object basis. After you create one or more custom compact layouts, you
set one as the primary compact layout for the object. The primary compact layout is then used as
the new default for that object.
If you have record types associated with an object, you can override the object’s primary compact
layout and assign different compact layouts to some or all of the record types. Each record type
can have only one compact layout assigned to it.
1. From the management settings for the object that you want to edit, go to Compact Layouts.
Tip: For Salesforce Knowledge articles, from Setup, enter Knowledge Article
Types in the Quick Find box, then select Knowledge Article Types, click the
name of an article type, then scroll down to the Compact Layouts related list.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Compact layouts are
available in: All editions
except Database.com
Record types are available
in: Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
2. Click Compact Layout Assignment.
3. Select a compact layout to use as the primary compact layout for this object.
4. In the Record Type Overrides section, select one or more record types to which you want to
assign a compact layout.
If you don’t have record types set for the object, you won’t see this section. If you don’t set any
record type overrides, all record types use the object’s primary compact layout by default.
To customize compact
layouts:
• Customize Application
To view compact layouts:
• View Setup and
Configuration
Some record types in the list might be inactive. You can assign a compact layout to an inactive
record type.
5. Select a compact layout from the Compact Layout To Use drop-down list to assign it to the selected cells.
6. Click Save.
SEE ALSO:
Find Object Management Settings
Notes on Compact Layouts
Keep these considerations in mind when using compact layouts.
EDITIONS
• Changes you make to a compact layout are reflected in both Lightning Experience and the
Salesforce app.
• Each record type can have only one compact layout assigned to it. However, the same compact
layout can be associated with multiple record types.
• Compact layouts aren’t assigned to profiles or individual users. To display different sets of fields
in records by use case or role, create record types for the object, then assign the appropriate
custom compact layout to each record type.
• If a user doesn’t have access to one of the fields that you assign to a compact layout, the next
field on the layout is used.
• A compact layout must contain at least one field.
46
Available in: Salesforce
Classic and Lightning
Experience
Available in: All editions
except Database.com
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
• Don’t make the primary field a lookup field. Doing this could result in navigation issues in Lightning Experience and the Salesforce
app.
• A compact layout can only contain fields from its object, including a formula field that is a cross-object reference to another object.
• Removing a field from a page layout doesn’t remove it from the object’s compact layout. The two layout types are independent.
• If you change a field on a compact layout to an unsupported type, the field is removed from the compact layout.
• Fields that aren’t available in the SOAP API don’t show up on compact layouts in the Salesforce app.
• Before you can delete a compact layout that’s set as the primary compact layout for the object, you must choose another compact
layout to replace it.
• In the Salesforce app, tasks automatically show whether a task is open or closed and the due date (depending on a user’s access to
activity dates). When customizing a task compact layout, you don’t need to add these fields to the Selected Fields list.
• Compact layouts aren’t available for the Chatter Mobile for BlackBerry or Dashboards for iPad mobile apps.
SEE ALSO:
Create Compact Layouts
Compact Layouts
Customize Case Hovers in Lightning Experience
Select Fields to Display in the Recently Viewed List on Object Home Pages in Lightning
Experience
As a Salesforce admin, you can customize the Recently Viewed list that appears on the home page
for most standard and custom objects. Choose and order the fields to display so that your users see
the information that’s most important for your company.
Note: These steps work in Lightning Experience. If you see the App Launcher icon ( ) on
the left side of the navigation bar at the top of your screen, you're in Lightning Experience. If
not, you're in Salesforce Classic.
For most list views, your users can select which fields to display and how to order the view columns.
However, they can’t edit the recent records quick list on object home pages. Only Salesforce admins
can select and order the fields to display for the recent records quick list. Admins can’t make any
other changes to this default list.
EDITIONS
Available in: Lightning
Experience
Available in: Essentials,
Group, Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
1. From Setup, at the top of the page, select Object Manager.
USER PERMISSIONS
2. Click the label name of the object for the Recently Viewed list you want to modify.
To customize recent records
list
• Customize Application
3. From the menu of links at the top of the page, click Search Layouts.
4. In the far right of the Search Results column, click
and select Edit.
5. To add columns to the Recently Viewed list, select one or more fields from Available Fields and
click Add. To remove columns, select one or more fields from Selected Fields and click Remove.
6. Order columns by selecting one or more fields from Selected Fields and clicking Up or Down.
7. Click Save.
Example: Your users collaborate on opportunities. To make it easy to see who worked on a recent opportunity last, select Last
Modified By from the Available Fields list. Click Add to move it to Selected Fields. Now this information appears on the Recently
Viewed list on the Opportunities home page.
47
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Customize Search Layouts
Customize which fields display for users in search results, search filter fields, lookup dialogs, the
recent records lists on tab home pages in Salesforce Classic, and in lookup phone dialogs for
Salesforce CRM Call Center.
You can specify a different set of fields to show in each search layout. The settings apply to all users
in your organization and Salesforce Customer Portal.
You can also customize which buttons display in custom list views and search results. You can hide
a standard list view button or display a custom button. Standard buttons aren’t available on search
result layouts. To display a custom button, create the custom button, giving it the List Button
Display Type.
1. From the management settings for the appropriate object, go to Search Layouts.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To change search layouts:
• Customize Application
2. Click Edit next to the layout you want to customize: search results, lookup dialogs, recent records
lists on tab home pages in Salesforce Classic, lookup phone dialogs, list views, and search filter
fields.
Note: In Lightning Experience, use Search Results under the Search Layouts customization setting to change which fields
appear in the search results for both global search and lookup search. You aren’t required to separately update Lookup Dialogs.
3. For list view and search results layouts, select the standard or custom buttons you want to display. To hide a standard button on the
list view, deselect it. Standard buttons aren't available on search result layouts.
4. Move fields between Available Fields and Selected Fields.
• To customize which fields display in the layout, select one or more fields and click Add or Remove.
• To sort fields in the layout, select one or more fields in Selected Fields and click Up or Down.
• To select multiple fields individually, use CTRL+click.
• To select multiple fields as a group, use SHIFT+click.
• To customize which items display in the layout, select the item and click Add or Remove.
• To sort items in the layout, select the item and click Up or Down.
Note: When editing a search results layout for an object, you can select the Override the search result column
customizations for all users checkbox. If selected, all user column customizations within your organization are overwritten
and restored to the organization-wide default settings.
5. Click Save.
Notes on Search Layouts
SEE ALSO:
Page Layouts
48
Extend Salesforce with Clicks, Not Code
Control User Access to Fields
Notes on Search Layouts
• Search layouts don’t apply to Salesforce CRM Content.
EDITIONS
• Search layouts don’t apply to campaign members, opportunity teams, or account teams.
• The search layout doesn’t control which fields are searched for keyword matches. The list of
fields searched is the same across Salesforce.
• You can add up to 10 fields to each search layout.
• You can’t remove unique identifying fields, such as Account Name or Case Number,
from the search layouts. These fields must be listed first in the order of fields in the search layout.
• You can ‘t add long text fields such as Description or Solution Details to search
layouts.
• All fields are available to be added to the search layout even if some fields are normally hidden
for the user customizing the search layout.
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To change search layouts:
• Customize Application
• For Professional, Enterprise, Unlimited, Performance, and Developer Edition organizations,
search layouts don’t override field-level security. If a field is included in the search layout but hidden for some users via field-level
security, those users do not see that field in their search results.
• For Personal, Contact Manager, Group, and Professional Edition organizations, search layouts override page layout settings. If a field
is included in the search layout but hidden in the page layout, that field will be visible in search results.
• The search results layouts for leads, accounts, contacts, and opportunities also apply to the search results displayed when finding
duplicate leads.
• Formula fields are not available in search result layouts.
• Don’t remove the Phone field from any lookup phone dialogs search layout. If you do, users can’t use the directory search results
to enter a phone number into a SoftPhone dial pad.
• To add a custom button to a list view or search layout, create the custom button for a standard or custom object, giving it the List
Button Display Type. The custom button will be available in the list view and search result layouts for that object.
Tip: In account search results, you can visually differentiate business accounts from person accounts by adding the Is Person
Account field, which displays as the person account icon ( ).
You may specify the Is Person Account field as the first column in account search layouts. Otherwise, Account Name
must be the first column.
49
Extend Salesforce with Clicks, Not Code
Show Custom Object Data for Your Users
Show Custom Object Data for Your Users
Custom tabs let you display custom object data or other web content in Salesforce. When you add
a custom tab to an app in Salesforce Classic, it displays as a tab. When you add a custom tab to an
app in Lightning Experience, it displays as an item in the app’s navigation bar.
Custom tabs display custom object data or other web content embedded in the app. You can create
any of these types of custom tabs.
Custom Object Tabs
Custom object tabs (available only at an app level and not on subtab apps) display the data of
your custom object. Custom object tabs look and function just like standard tabs.
Web Tabs
Custom web tabs display any external web-based application or web page. You can design
web tabs to include the sidebar or span across the entire page without the sidebar.
Visualforce Tabs
Visualforce tabs display data from a Visualforce page. Visualforce tabs look and function just
like standard tabs.
Lightning Component Tabs
Lightning component tabs make Lightning components available in the Salesforce app (via
the navigation list) or in Lightning Experience. Lightning components aren’t supported in
Salesforce Classic.
Note: To expose Lightning components via Lightning component tabs, you must enable
and deploy My Domain.
Lightning Page Tabs
Lightning page tabs let you add “App Page” Lightning pages to the Salesforce app navigation
list and the Lightning Experience navigation bar.
In Salesforce Classic, Lightning page tabs don’t display on the All Tabs page when you click .
Lightning page tabs also don’t appear in the Available Tabs list when you customize the tabs
for your apps.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Custom Object Tabs and
Web Tabs available in:
Contact Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Visualforce Tabs available
in: Contact Manager,
Group, Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Lightning Page Tabs
available in: All Editions
except Database.com
USER PERMISSIONS
To create and edit custom
tabs:
• Customize Application
Subtab apps support only web tabs and Visualforce tabs.
Delegated administrators who can manage specified custom objects can also create and customize tabs for those custom objects.
In Lightning Experience, Lightning page tabs, Visualforce tabs, and Lightning component tabs have a fixed, friendly URL structure of
/one/one.app#/n/customTabDevName.
SEE ALSO:
Create Custom Apps for Salesforce Classic
What is a Subtab App?
50
Extend Salesforce with Clicks, Not Code
Show Custom Object Data for Your Users
Create Web Tabs
Build web tabs so that your users can use your web applications or other websites from within the
application.
EDITIONS
1. From Setup, enter Tabs in the Quick Find box, then select Tabs.
Available in: both Salesforce
Classic and Lightning
Experience
2. Click New in the Web Tabs related list.
3. Choose a layout for the new tab. The full page width spans across the entire page without the
sidebar, while the column style allows users to view the sidebar.
4. Click Next.
5. Enter a label to display on the tab.
6. Click the Tab Style lookup icon to display the Tab Style Selector.
If a tab style is already in use, a number enclosed in brackets [] appears next to the tab style
name. Hover your mouse over the style name to view the tabs that use the style. Click Hide
styles which are used on other tabs to filter this list.
7. Click a tab style to select the color scheme and icon for the custom tab.
Optionally, click Create your own style on the Tab Style Selector dialog to create a custom
tab style if your org has access to the Documents tab. To create your own tab style:
a. Click the Color lookup icon to display the color selection dialog and click a color to select
it.
Custom Object Tabs and
Web Tabs available in:
Contact Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Visualforce Tabs available
in: Contact Manager,
Group, Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Lightning Page Tabs
available in: All Editions
except Database.com
b. Click Insert an Image, select the document folder, and select the image you want to use.
Alternatively, click Search in Documents, enter a search term, and click Go! to find a
document file name that includes your search term.
Note: This dialog only lists files in document folders that are under 20 KB and have
the Externally Available checkbox selected in the document property settings. If the
document used for the icon is later deleted, Salesforce replaces it with a default
multicolor block icon (
USER PERMISSIONS
To create and edit custom
tabs:
• Customize Application
).
c. Select a file and click OK. The New Custom Tab wizard reappears.
8. Change the content frame height if necessary.
9. Optionally, select Salesforce Mobile Classic Ready to indicate that the web page displays and functions properly
in the Salesforce Mobile Classic app.
Selecting this checkbox adds the tab to the list of available tabs for your Salesforce Mobile Classic configurations. Before mobilizing
a web tab, review the Salesforce Mobile Classic tab considerations to ensure that the pages in your web tabs are compatible with
mobile browsers.
Note: The Salesforce Mobile Classic Ready checkbox is only visible if Salesforce Mobile Classic is enabled
for your organization.
10. Optionally, choose a custom link to use as the introductory splash page when users initially click the tab. Don’t use a splash page if
you plan to mobilize the web tab, as splash pages don’t display in the mobile application.
11. Enter a description of the tab, if desired, and click Next.
12. Enter the URL or choose the custom s-control that you want to display in the tab. Optionally, copy and paste any merge fields for
data that you want dynamically replaced in the link.
51
Extend Salesforce with Clicks, Not Code
Show Custom Object Data for Your Users
Note: Only User, organization, and API merge fields are supported for web tabs.
Click Preview Web Tab to display your web tab.
13. For a URL, choose an encoding setting and click Next.
14. Add the web tab to the appropriate profiles. Choose Default On, Default Off, or Tab Hidden to determine whether the custom tab
is visible to users with that profile. You can change this setting later.
15. Click Next.
16. Specify the custom apps that should include the new tab.
17. Select Append tab to users' existing personal customizations to apply the tab visibility settings to all users.
18. Click Save.
Create a Custom Object Tab
Define a tab to display the data stored in your custom object records.
EDITIONS
1. From Setup, enter Tabs in the Quick Find box, then select Tabs.
2. Click New in the Custom Object Tabs related list.
3. Select the custom object to display in the custom tab. If you have not already created the
custom object, click create a new custom object now and follow the instructions in Define
a Custom Object on page 86.
The label of the new tab is the same as the plural version of the custom object label.
4. Click the Tab Style lookup icon to display the Tab Style Selector.
If a tab style is already in use, a number enclosed in brackets [] appears next to the tab style
name. Hover your mouse over the style name to view the tabs that use the style. Click Hide
styles which are used on other tabs to filter this list.
5. Click a tab style to select the color scheme and icon for the custom tab.
Optionally, click Create your own style on the Tab Style Selector dialog to create a custom
tab style if your org has access to the Documents tab. To create your own tab style:
a. Click the Color lookup icon to display the color selection dialog and click a color to select
it.
b. Click Insert an Image, select the document folder, and select the image you want to use.
Alternatively, click Search in Documents, enter a search term, and click Go! to find a
document file name that includes your search term.
Note: This dialog only lists files in document folders that are under 20 KB and have
the Externally Available checkbox selected in the document property settings. If the
document used for the icon is later deleted, Salesforce replaces it with a default
multicolor block icon (
Available in: both Salesforce
Classic and Lightning
Experience
Custom Object Tabs and
Web Tabs available in:
Contact Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Visualforce Tabs available
in: Contact Manager,
Group, Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Lightning Page Tabs
available in: All Editions
except Database.com
USER PERMISSIONS
To create and edit custom
tabs:
• Customize Application
).
c. Select a file and click OK. The New Custom Tab wizard reappears.
6. Optionally, choose a custom link to use as the introductory splash page when users initially click the tab.
7. Enter a description of the tab, if desired, and click Next.
52
Extend Salesforce with Clicks, Not Code
Show Custom Object Data for Your Users
8. Choose the user profiles for which the new custom tab will be available.
For Professional Edition users and Salesforce Platform One license users, tab visibility is set to Default On.
Note: Custom object records are searchable in the Salesforce user interface only if the custom object is associated with a
custom tab. Users aren't required to add the tab for display.
9. Specify the custom apps that should include the new tab.
10. Select Append tab to users' existing personal customizations to add the tab to your users’ customized display settings if they
have customized their personal display.
11. Click Save.
Depending on the visibility settings you selected, you’ll see the tab right away:
SEE ALSO:
Show Custom Object Data for Your Users
Make Search Faster
Create Lightning Page Tabs
Before you can include an App Page type of Lightning page in the Salesforce app navigation list or
in a Lightning app, you must create a custom tab for it.
EDITIONS
When you first activate an app page in the Lightning App Builder, a tab is created for the page as
part of the activation process. You can also create a tab for the page manually in Setup before you
activate it.
Available in: Salesforce
Classic
Lightning page tabs only facilitate inclusion of the Lightning page in the Salesforce app and Lightning
Experience.
You can create a custom tab only for an App Page type of Lightning page.
1. From Setup, enter Tabs in the Quick Find box, then select Tabs.
2. Click New in the Lightning Page Tabs related list.
3. Choose a Lightning page for the tab.
53
Available in: All editions
except Database.com
USER PERMISSIONS
To create and edit custom
tabs:
• Customize Application
Extend Salesforce with Clicks, Not Code
Show Custom Object Data for Your Users
4. Enter a label.
This text is used as the display name for the Lightning page.
5. Select a tab style to set a color scheme and icon for the Lightning page tab.
Optionally, click Create your own style on the Tab Style Selector dialog to create a custom tab style if your org has access to the
Documents tab. To create your own tab style:
a. Click the Color lookup icon to display the color selection dialog and click a color to select it.
b. Click Insert an Image, select the document folder, and select the image you want to use.
Alternatively, click Search in Documents, enter a search term, and click Go! to find a document file name that includes your
search term.
Note: This dialog only lists files in document folders that are under 20 KB and have the Externally Available checkbox
selected in the document property settings. If the document used for the icon is later deleted, Salesforce replaces it with
a default multicolor block icon (
).
c. Select a file and click OK. The New Custom Tab wizard reappears.
6. Enter a description of the tab, if desired, and click Next.
7. Choose the user profiles for which the new custom tab will be available.
Note: In Salesforce Classic, the Default On and Default Off options for Lightning page tabs don’t work the same way as for
other custom tabs. The Lightning page menu item appears for the selected profiles in Salesforce for Android, Salesforce for
iOS, and Salesforce mobile web whether you choose Default On or Default Off. Select the Tab Hidden option to hide the
Lightning page for the selected profiles.
8. Click Save.
Tip: When creating a custom icon for your Lightning page tab, follow these image guidelines. The icon should:
• Be less than 10k in size
• Be 120 x 120 pixels
• Be a PNG with a transparent background
• Have a resolution of 72 dpi
• Not include a color background
• Not include outer shadows on the inner icon graphic
54
Extend Salesforce with Clicks, Not Code
Give Your Users Custom Help Content
Custom Tab Considerations
When working with custom tabs, keep these considerations in mind.
EDITIONS
• To enable Visualforce or web tabs for use in the Salesforce Mobile Classic app, edit the properties
of the tabs and select the Salesforce Mobile Classic Ready checkbox.
• The custom tabs limit is a fixed number based on edition and can’t be increased. For more
information, contact Salesforce.
• If you choose Default On or Default Off when setting custom object tab visibility, an option is
added to the Create New drop-down list in the Salesforce Classic sidebar so that users with
the “Create” permission can quickly create a record. For example, if the custom object displayed
in the custom tab is named Expenses, an Expense option appears in this list.
• Custom object records are searchable in the Salesforce user interface only if the custom object
is associated with a custom tab. Users aren't required to add the tab for display.
• A Web tab or custom link could display a blank page if the embedded site:
– Has been set to deny the loading of its content in a frame.
– Has been set to allow the loading of its content in a frame only if the same site is delivering
the content.
– Contains a mix of secure and unsecure content, and the user’s browser has been configured
to block mixed active content.
To resolve this issue, try these workarounds.
Available in: both Salesforce
Classic and Lightning
Experience
Custom Object Tabs and
Web Tabs available in:
Contact Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Visualforce Tabs available
in: Contact Manager,
Group, Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Lightning Page Tabs
available in: All Editions
except Database.com
– Set your custom link to either open in a new window or display in the existing window
without the sidebar or header.
– Move the URL from a Web tab into a custom link instead, and set the URL to either open in a new window or display in the
existing window without the sidebar or header.
– If the site you’re embedding has an HTTP prefix and mixed active content, try changing the prefix to HTTPS. If the embedded
site has a valid security certificate and it hasn’t blocked itself from being displayed in frames, using HTTPS as the prefix allows
the site to display.
• In Salesforce Classic, Lightning page tabs don’t display on the All Tabs page when you click
in the Available Tabs list when you customize the tabs for your apps.
. Lightning page tabs also don’t appear
• In Salesforce Classic, the Default On and Default Off options for Lightning page tabs don’t work the same way as for other custom
tabs. The Lightning page menu item appears for the selected profiles in Salesforce for Android, Salesforce for iOS, and Salesforce
mobile web whether you choose Default On or Default Off. Select the Tab Hidden option to hide the Lightning page for the selected
profiles.
Give Your Users Custom Help Content
You can supply your own custom help content that overrides the standard Salesforce
context-sensitive online help topics for your custom objects, and you can add field-level help that
appears when users hover their mouse over a field.
The Help & Training link at the top of every page opens a portal full of online help topics, solutions,
and recommended training classes. The Help for this Page link on any page takes you to information
about things you can do with the page you’re on right now.
55
EDITIONS
Available in: Salesforce
Classic
Available in: All Editions
except Database.com
Extend Salesforce with Clicks, Not Code
Give Your Users Custom Help Content
With Salesforce custom help, you can augment these standard help features with information on using fields and functionality unique
to your organization or the Force.com AppExchange app you are developing.
Getting Started with Field-Level Help
Define Field-Level Help
Getting Started with Object-Level Help
Replace Built-in Help in Salesforce Classic with Custom Help
If you rename standard tabs, objects, fields, and other related user interface labels, you can also replace the built-in Salesforce Help
with documentation that’s customized specifically for your users. To replace the built-in help, simply provide a URL to your custom
help. This feature is available for Salesforce Classic only.
Getting Started with Field-Level Help
Field-level help lets you provide help text detailing the purpose and function of any standard or custom field. You can define custom
help text for your organization’s fields to provide users with a helpful description for any field on all detail and edit pages where that
field displays. Users can view the field-level help text by hovering over the Info icon next to the field.
Before you begin defining field-level help, review these implementation tips and best practices.
Implementation Tips
• Field-level help is enabled by default for all editions.
• Field-level help is not available for some standard fields, including fields on the User object, system read only fields, auto-number
fields, multi-currency fields, Ideas fields, and Community fields.
• The help text for a field is automatically added to a package when you add the associated field to any Force.com AppExchange
package.
• In a managed package, the help text is locked to the developer, giving installers full capabilities to change it.
Best Practices
• Because your custom help text displays on both edit and detail pages, avoid instructions for entering data. Instead, construct help
text that defines the field's purpose, such as:
The maximum discount allowed for this account.
• Provide information in your help text about the attributes of the field, such as:
A detailed description of the purpose for the expense report. Up to 32 KB of data
are allowed. Only the first 255 characters display in reports.
• Provide examples in your help text that help users understand the field's meaning clearly, such as:
The four-digit promotional code used to determine the amount charged to the customer,
for example, 4PLT (for level-four platinum pricing).
• If your organization uses more than one language, provide translations for your Help Text using the Translation Workbench.
SEE ALSO:
Give Your Users Custom Help Content
Define Field-Level Help
56
Extend Salesforce with Clicks, Not Code
Give Your Users Custom Help Content
Define Field-Level Help
Field-level help lets you provide help text detailing the purpose and function of any standard or
custom field. You can define custom help text for your organization’s fields to provide users with
a helpful description for any field on all detail and edit pages where that field displays. Users can
view the field-level help text by hovering over the Info icon next to the field.
1. From the management settings for the field’s object, go to Fields.
2. Click Edit next to the field.
3. In the Help Text field, enter the text you want displayed when a user hovers the mouse
over the Info icon that appears next to the field on a detail or edit page. You can enter up to
255 characters.
4. Click Save.
Note: If the object you’re modifying is exposed in a community, field-level help is visible to
community members, including unlicensed users, partners, and customers. Make sure the
information you provide in field-level help accounts for all audiences and doesn’t contain
business-sensitive information.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
except Database.com
USER PERMISSIONS
To define or change
field-level help:
• Customize Application
SEE ALSO:
Give Your Users Custom Help Content
Getting Started with Field-Level Help
Find Object Management Settings
Getting Started with Object-Level Help
Help your users by providing object-level help for your custom and external objects. This way, when your users click the Help for this
Page link on your custom object, they’ll find useful information that’s relevant to your custom object.
Note: If you don’t create object-level help, the Help for this Page link provides information about standard objects that won’t
be relevant to your custom object.
You can override the Help for this Page links for a custom object or external object with help content contained in a Visualforce page.
But don’t worry! You don’t have to learn Visualforce to add help content to your custom objects.
When you add custom help to a custom or external object, the Help for this Page link on those object pages displays your custom
help instead of generic help. Your users can access the custom help content from the object home (overview), detail, and edit pages,
list views, and related lists.
You can create object-level help for all custom objects and external objects in the Salesforce editions that support custom and external
objects. For more information, see Salesforce Limits.
SEE ALSO:
Give Your Users Custom Help Content
Define Object-Level Help
Object-Level Help Best Practices and Considerations
57
Extend Salesforce with Clicks, Not Code
Give Your Users Custom Help Content
Define Object-Level Help
Object-level help overrides the Help for this Page links for a custom object or external object with
your own help content contained in a Visualforce page. To make object-level help available to all
your users, create a Visualforce page that contains your help content. Then edit the custom or
external object definition to reference the page. Object-level help becomes available to all your
users instantly.
1. Create a Visualforce page that contains your help content.
2. Edit the custom object definition or external object definition that uses the custom help when
users click the Help for this Page link.
3. For Context-Sensitive Help Setting, select Open a window using a Visualforce
page.
EDITIONS
Available in: both Salesforce
Classic
Custom objects are
available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Salesforce Connect external
objects are available in:
Developer Edition and for
an extra cost in: Enterprise,
Performance, and
Unlimited Editions
4. Select the Visualforce page that contains your help content.
5. Click Save.
SEE ALSO:
Getting Started with Object-Level Help
Give Your Users Custom Help Content
USER PERMISSIONS
To define or change
object-level help:
• Customize Application
58
Extend Salesforce with Clicks, Not Code
Give Your Users Custom Help Content
Create a Custom Object Help Page with Static Content
If you know HTML, it’s easy to add help to your custom objects by writing the content in HTML and
saving it in a Visualforce page. No need to learn Visualforce. Just use the template that we provide.
EDITIONS
1. From Setup, enter Visualforce Pages in the Quick Find box, then select
Visualforce Pages.
Available in: both Salesforce
Classic
2. Click New.
The Visualforce page editor opens with a new page.
Custom objects are
available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
3. Complete the following fields.
Field
Description
Label
The human-friendly name of the page used to identify the page in
Setup tools.
Tip: It’s a great idea to have a naming convention for your
custom help pages. For example, start all custom help pages
with “Help_” and then the object name.
Name
The API name for the page. You can use the auto-filled value.
Description
An optional description of the page.
Available for
Salesforce
mobile apps
and Lightning
Pages
Select this option if your custom object is available in the Salesforce
app.
Salesforce Connect external
objects are available in:
Developer Edition and for
an extra cost in: Enterprise,
Performance, and
Unlimited Editions
Visualforce is available in:
Contact Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
To define or change
object-level help:
• Customize Application
4. Click Quick Save.
5. In the Visualforce Markup tab code editor, select the default code and delete it.
6. Paste the following help template code into the code editor.
To create or edit Visualforce
pages:
• Customize Application
<apex:page showHeader="false">
<!-- Add your help styles -->
<h1>Help for {YourObjectName} Object</h1>
<p>Your custom help message here.</p>
</apex:page>
7. Click Quick Save.
8. Edit the template to add your help content.
To add formatting to your page, use HTML markup. You can also use Visualforce markup if you know it.
9. Click Save.
59
Extend Salesforce with Clicks, Not Code
Give Your Users Custom Help Content
You can now add this page as custom help. When users click Help for this Page, they see this page in the Help & Training window.
SEE ALSO:
Define Object-Level Help
Create Custom Object Help with a PDF File
Object-Level Help Best Practices and Considerations
Create Custom Object Help with a PDF File
Add help to your custom objects by creating Visualforce pages that redirect to PDF help files or a
URL. No need to learn Visualforce. Just use the template that we provide.
EDITIONS
You can write your help content in an authoring tool such as Microsoft Word and convert it to a
PDF file.
Available in: both Salesforce
Classic
1. Upload your PDF file as a static resource.
Custom objects are
available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Users see this PDF file when they request help with the custom object.
2. From Setup, enter Visualforce Pages in the Quick Find box, then select
Visualforce Pages.
3. Click New.
The Visualforce page editor opens with a new page.
4. Complete the following fields.
Field
Description
Label
The human-friendly name of the page used to identify the page in
Setup tools.
Tip: It’s a great idea to have a naming convention for your
custom help pages. For example, start all custom help pages
with “Help_” and then the object name.
Name
The API name for the page. You can use the auto-filled value.
Description
An optional description of the page.
Available for
Salesforce
mobile apps
and Lightning
Pages
Select this option if your custom object is available in the Salesforce
app.
Salesforce Connect external
objects are available in:
Developer Edition and for
an extra cost in: Enterprise,
Performance, and
Unlimited Editions
Visualforce is available in:
Contact Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
To define or change
object-level help:
• Customize Application
To create or edit Visualforce
pages:
• Customize Application
5. Click Quick Save.
6. In the Visualforce Markup tab code editor, select the default code and delete it.
7. Paste the following help template code into the code editor.
<apex:page showHeader="false" action="{! URLFOR($Resource.YourCustomHelpResource) }">
60
Extend Salesforce with Clicks, Not Code
Give Your Users Custom Help Content
<!-- This page redirects to the URL in the action attribute above -->
<p>Redirecting to help content...</p>
</apex:page>
8. Replace YourCustomHelpResource in the action attribute with the name of the static resource that you uploaded.
9. Click Save.
You can now add this page as help. When users click Help for this Page, they’re redirected to the resource you set in the action attribute.
Note: The user’s browser controls the behavior of a PDF link, not your Visualforce page. The PDF content might display in the
browser or be downloaded as a PDF file.
SEE ALSO:
Define Object-Level Help
Create a Custom Object Help Page with Static Content
Object-Level Help Best Practices and Considerations
Object-Level Help Best Practices and Considerations
Before defining object-level help text for your custom or external objects, review these best practices
and implementation considerations.
EDITIONS
Available in: Salesforce
Classic
Best Practices
• The window that displays your object-level help has the same height and width dimensions
as the standard Salesforce Help & Training window. To increase the usability of your help content,
size and style your content appropriately.
• To give your custom help a professional tone using Salesforce terminology, follow the Salesforce
Style Guide for Documentation and User Interface Text.
• Your Visualforce help content pages can use merge fields or other functions to make the
experience more personalized. For example, you can design the help to add the user’s name
when the help page is displayed.
Advanced Implementation Considerations
• Create custom help Visualforce pages without a controller, or use a custom controller. You can’t
use a standard controller.
• If you have defined object-level help for an object that you add to a Force.com AppExchange
package, Salesforce adds the Visualforce page or static resource referenced in your
Context-Sensitive Help Settings for that object.
• In managed packages, object-level help is locked to the developer, giving installers the ability
to change it if needed.
SEE ALSO:
Define Object-Level Help
Getting Started with Object-Level Help
61
Custom objects are
available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Salesforce Connect external
objects are available in:
Developer Edition and for
an extra cost in: Enterprise,
Performance, and
Unlimited Editions
Visualforce is available in:
Contact Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Extend Salesforce with Clicks, Not Code
Tailor Business Processes to Different Users
Replace Built-in Help in Salesforce Classic with Custom Help
If you rename standard tabs, objects, fields, and other related user interface labels, you can also replace the built-in Salesforce Help with
documentation that’s customized specifically for your users. To replace the built-in help, simply provide a URL to your custom help. This
feature is available for Salesforce Classic only.
Users can view this URL whenever they click on any context-sensitive help link on an end-user page or within their personal settings.
After you replace the help, the Help & Training link at the very top of every page and all Setup pages will continue to display the
Salesforce Help.
1. From Setup, enter Help Settings in the Quick Find box, then select Help Settings.
2. Enter the complete URL for your help file that you would like to replace the Salesforce Help.
3. Click Save.
Considerations for Replacing the Salesforce Help
• When you replace the Salesforce Help with your own help file, the Help & Training link still displays Salesforce Help. However, other
than within Setup, the Help for this Page links on all pages are no longer context-sensitive. That is, your help file will open at the
same place regardless of which page the user is viewing when they click the link.
• You can make your help context-sensitive by taking advantage of the context-specific parameters that are passed with each help
link. For example, the help link from the Opportunities tab home page is constructed as follows (without any line breaks):
http://your_help_file.com?loc=help&amp;body=%2Fhelp%2Fdoc%2Fen%2Fhelp2.jsp
&target=opp_overview.htm&section=Opportunities
The values of the target and section parameters are unique for every page within the application. You can parse these
parameters to display context-sensitive help content for your users.
Tailor Business Processes to Different Users
Record types let you offer different business processes, picklist values, and page layouts to different
users. You might create record types to differentiate your regular sales deals from your professional
services engagements, offering different picklist values for each. Or you might display different page
layouts for your customer support cases versus your billing cases.
Example: Here’s an example of how record types can work in your org. Let’s say you have
two sales divisions, hardware and consulting, and only your consulting division receives leads
through seminars. You can choose to display the Seminar contact lead source for the consulting
division only.
Step 1: Manage master picklists
Define a list of contact Lead Source picklist values that contains all of the values
used by both the Hardware and Consulting divisions, including Seminar.
Step 2: Create record types
Create two contact record types: one called Hardware and another called Consulting.
This step includes adding master picklist values to the record types.
Step 3: Add record types to profiles
Add the Hardware record type to the profiles for all users in the hardware sales division.
Add the Consulting record type to the profiles of all users in the consulting sales division.
62
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create or change record
types:
• Customize Application
Extend Salesforce with Clicks, Not Code
Tailor Business Processes to Different Users
Step 4: Set personal options for record types
Allow users of both the hardware and consulting sales divisions to bypass the prompt that asks them to select a record type
when creating a new contact. If you have users that create contact records for both sales divisions, they can customize their
personal settings to always prompt them to select a record type.
Considerations for Creating and Updating Record Types and Picklists
Keep these considerations in mind when working with record types and business process picklists.
Create Record Types
Edit Picklists for Record Types and Business Processes
Customize the values in record type or business process picklists based on your organization’s unique needs.
Limitations for Creating and Updating Record Types and Picklists
Keep these limitations in mind when working with record types and business process picklists.
Managing Multiple Business Processes
Create Multiple Business Processes
SEE ALSO:
How is record type access specified?
Considerations for Creating and Updating Record Types and Picklists
Keep these considerations in mind when working with record types and business process picklists.
• Before creating record types, include all of the possible record type values in your master list
of picklists. The master picklist is a complete list of picklist values that can be used in any record
type.
• The master picklist is independent of all record types and business processes. If you add a picklist
value to the master picklist, you must manually include the new value in the appropriate record
types. If you remove a picklist value from the master, it is no longer available when creating
new records, but records assigned to that value are unchanged.
• When you create a new record type without cloning an existing one, the new record type
automatically includes the master picklist values for both standard and custom picklists. You
can then customize the picklist values for the record type.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• A user can be associated with several record types. For example, a user who creates marketing campaigns for both U.S. and European
divisions can have both U.S. and European campaign record types available when creating new campaigns.
• When creating and editing record types for accounts, opportunities, cases, contacts, or custom objects, check for criteria-based
sharing rules that use existing record types as criteria. A record type change may affect the number of records that the rule shares.
For example, let's say you have a record type named “Service,” and you created a criteria-based sharing rule that shares all Service
record types with your service team. If you create another record type named “Support” and you want these records shared with
your service team, update the sharing rule to include Support record types in the criteria.
• Renaming a record type doesn’t change the list of values included in it.
• Deactivating a record type doesn’t remove it from any user profiles or permission sets.
• Deleting a record type also deletes the related path.
• Deleting campaign member record types updates the Campaign Member Type field on campaign and campaign member
records.
63
Extend Salesforce with Clicks, Not Code
Tailor Business Processes to Different Users
• Person accounts are account records to which a special kind of record type has been assigned. These record types are called person
account record types. Person account record types allow contact fields to be available on the account and allow the account to be
used as if it were a contact. A default person account record type named “Person Account” is automatically created when person
accounts are enabled for your org. You can change the name of this record type, and you can create additional person account
record types.
• From the UI, you can change an account’s record type from a business account to a business account or from a person account to
a person account. However, to change an account’s record type from a business account to a person account, or vice versa, you
must use the API.
• When users convert, clone, or create records, these special considerations apply.
– When a user converts a lead, the new account, contact, and opportunity records use the default record type for the owner of
the new records. The user can choose a different record type during conversion.
– When a user clones a record, the new record has the record type of the cloned record. If the user’s profile doesn’t have access
to the record type of the cloned record, the new record adopts the user’s default record type.
– When a user creates a case or lead and applies assignment rules, the new record can keep the creator’s default record type or
take the record type of the assignee, depending on the case and lead settings specified by the administrator.
SEE ALSO:
Tailor Business Processes to Different Users
Create Record Types
Limitations for Creating and Updating Record Types and Picklists
Create Record Types
Tip: Before creating record types, include all of the possible record type values in your master
list of picklists. The master picklist is a complete list of picklist values that can be used in any
record type.
1. From the management settings for the appropriate object, go to Record Types.
2. Click New.
3. Choose Master from the Existing Record Type drop-down list to copy all available
picklist values, or choose an existing record type to clone its picklist values.
Note: When you create a new record type without cloning an existing one, the new
record type automatically includes the master picklist values for both standard and custom
picklists. You can then customize the picklist values for the record type.
4. Enter a Record Type Label that's unique within the object.
5. Enter a Record Type Name. The Record Type Name refers to the component when using
the Web services API and prevents naming conflicts on package installation in managed
packages.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create or change record
types:
• Customize Application
6. For opportunity, case, lead, and solution record types, select a business process to associate with the record type.
7. Enter a description.
8. Select Active to activate the record type.
9. Select Enable for Profile next to a profile to make the record type available to users with that profile. Select the checkbox
in the header row to enable it for all profiles.
64
Extend Salesforce with Clicks, Not Code
Tailor Business Processes to Different Users
Tip: If each profile is associated with a single record type, users will never be prompted to select a record type when creating
new records.
10. For enabled profiles, select Make Default to make it the default record type for users of that profile. Select the checkbox in the
header row to make it the default for all profiles.
11. Click Next.
12. Choose a page layout option to determine what page layout displays for records with this record type:
• To apply a single page layout for all profiles, select Apply one layout to all profiles and choose the page
layout from the drop-down list.
• To apply different page layouts based on user profiles, select Apply a different layout for each profile
and choose a page layout for each profile.
13. Click Save to edit the values of the standard and custom picklists available for the record type, or click Save and New to create
another record type.
SEE ALSO:
Tailor Business Processes to Different Users
Considerations for Creating and Updating Record Types and Picklists
Limitations for Creating and Updating Record Types and Picklists
Edit Picklists for Record Types and Business Processes
Customize the values in record type or business process picklists based on your organization’s
unique needs.
EDITIONS
1. Select a record type or business process and click Edit next to the picklist field to change its
values.
Available in: both Salesforce
Classic and Lightning
Experience
2. Add or remove values as needed. Users can choose from these values when creating or editing
records.
3. Optionally, choose a default picklist value. Some picklists require a default value. The default
value in a dependent field is ignored.
4. Click Save.
Record types are available
in: Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Business processes are
available in: Enterprise,
Performance, Unlimited,
and Developer Editions
SEE ALSO:
Custom Fields
USER PERMISSIONS
To create or change record
types:
• Customize Application
To create or change
business processes:
• Customize Application
65
Extend Salesforce with Clicks, Not Code
Tailor Business Processes to Different Users
Limitations for Creating and Updating Record Types and Picklists
Keep these limitations in mind when working with record types and business process picklists.
• These special picklist fields aren’t available for record types because they are used exclusively
for sales processes, lead processes, support processes, and solution processes:
– Opportunity Stage
– Case Status
– Solution Status
– Lead Status
You can use these fields to provide different picklist values for different record types by assigning
a different process to each record type.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• These campaign member picklists aren’t available for record types:
– Status
– Salutation
– Lead Source
• You can’t edit or delete a record type for an object if the object is referenced in Apex.
• You can’t deactivate a record type if it is in use by an email routing address for Email-to-Case or On-Demand Email-to-Case.
• Record types can only be assigned to campaign members using the Campaign Member Type field on new or existing
campaigns. To assign record types to campaign members, add the Campaign Member Type field to the campaign page
layout. You must have the Marketing User user permission to change the campaign member type. You can also add a
read-only Campaign Member Type field to the campaign members page layout.
• We recommend creating no more than 200 record types. While there is no limit, orgs may have difficulty managing their record
types if they exceed 200.
SEE ALSO:
Create Record Types
Considerations for Creating and Updating Record Types and Picklists
Managing Multiple Business Processes
Use multiple business processes to display different picklist values for users based on their profile.
Multiple business processes allow you to track separate sales, support, and lead lifecycles.
EDITIONS
Sales Processes
Create different sales processes that include some or all of the picklist values available for the
opportunity Stage field.
Available in: both Salesforce
Classic and Lightning
Experience
Lead Processes
Create different lead processes that include some or all of the picklist values available for the
Lead Status field.
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
Support Processes
Create different support processes that include some or all of the picklist values available for
the case Status field.
USER PERMISSIONS
To create or change
business processes:
• Customize Application
66
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Solution Processes
Create different solution processes that include some or all of the picklist values available for the Status field.
After creating a sales, support, lead, or solution process, assign the process to a record type. The record type determines the user profiles
that are associated with the business process.
To view a list of business processes, from Setup, enter Processes in the Quick Find box, then select the appropriate link.
SEE ALSO:
Edit Picklists for Record Types and Business Processes
Administrator tip sheet: Tips & Hints for Multiple Business Processes
Create Multiple Business Processes
Follow these steps to create sales processes, support processes, lead processes, and solution
processes.
EDITIONS
1. From Setup, enter Processes in the Quick Find box, then select the appropriate link.
Available in: both Salesforce
Classic and Lightning
Experience
2. Click New.
3. Choose an existing process to copy its picklist values into the new process. Select Master to
copy all available picklist values.
4. Enter a name and description for the new process. The name must be unique within the tab.
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
5. Click Save.
All of the available values in the picklist are displayed. Choose the values that you would like
included in the new business process.
Next, add the new business process to a record type, and then make the record type available to
users based on profile.
USER PERMISSIONS
To create or change
business processes:
• Customize Application
Support Users in Multiple Languages
If your org has multiple languages enabled, use Translation Workbench to maintain your translated
labels in your org. You can manage translated values for any Salesforce supported language.
Note: Standard objects aren’t available in the Translation Workbench. Use the rename tabs
and labels interface for standard object translation.
If a customized component doesn’t have a translated value, the component uses the org’s default
language. When you deactivate a language, all translations for that language are still available in
the Translation Workbench, but users with that language selected see the org’s default language
values.
Translation Workbench isn’t available for single-language orgs. If you aren’t sure whether you have
a single-language or multi-language organization, contact Salesforce.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Enabling the Translation Workbench makes these changes to your Salesforce org.
• You must edit picklist values individually. You can’t mass-edit existing picklist values, but you can still mass-add new values.
• When picklist values are sorted alphabetically, the values are alphabetical by the org’s default language.
• Reports have a Filter Language drop-down list in the Filters pane of the report builder. Selecting a language filters on translated
strings for any filter criteria that use the starts with, contains, or does not contain operator.
67
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
• Import files have a Language drop-down list, and all records and values within the import file must be in the selected language.
• Web-to-Lead and Web-to-Case have a Language drop-down list before you generate the HTML.
Enable and Disable the Translation Workbench
The Tranlsation Workbench lets you specify languages you want to translate, assign translators to languages, create translations for
customizations you’ve made to your Salesforce organization, and override labels and translations from managed packages. Everything
from custom picklist values to custom fields can be translated so your global users can use all of Salesforce in their language.
Add Translated Languages and Translators
Add supported languages, activate or deactivate a language, assign translators for that language, and enter translated terms for
customizations you've made in your org's default language.
Translate Terms
Override Translations in Managed Packages
Although you can't edit labels or translations in a managed package, they are controlled by the developer, you can override them
with the Translation Workbench. For example, override a custom field in a package.
Translatable Customizations
You can translate only certain components.
Translation Files
Translate customization labels or review translations with Salesforce Translation Format (.stf) or XML Localization Interchange File
Format (.xlf) files.
Considerations for Translation Workbench
Learn about updating translated terms and translating flows.
Exporting Translation Files
Create files that contain your org’s translatable metadata, such as custom fields, report types, and picklist values. Send these files to
your outside translators or translation agency for bulk translation activities, then use Import to update your labels.
Import Translated Files
Import and update the translations for your org’s metadata, such as custom fields, report types, and picklist values. Typically, the
original files are exported from Salesforce, then sent to your outside translators or translation agency for bulk translation activities
and returned to you for importing.
Common Errors with Exporting and Importing Translation Files
Troubleshoot issues you might encounter while exporting and importing files in the Translation Workbench.
Best Practices for the Translation Workbench
To make the Translation Workbench most effective, keep these tips in mind.
68
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Enable and Disable the Translation Workbench
The Tranlsation Workbench lets you specify languages you want to translate, assign translators to
languages, create translations for customizations you’ve made to your Salesforce organization, and
override labels and translations from managed packages. Everything from custom picklist values
to custom fields can be translated so your global users can use all of Salesforce in their language.
1. From Setup, enter Translation Settings in the Quick Find box, then select
Translation Settings.
2. On the welcome page, click Enable.
Note: The “Manage Translation” permission is enabled by default in the System Administrator
profile.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
To disable the Translation Workbench, from Setup, enter Translation Settings in the
Quick Find box, select Translation Settings, and then click Disable.
Note: In a Developer organization with a managed package containing translations, once the Translation Workbench is enabled,
it can't be disabled.
SEE ALSO:
Considerations for Updating Translated Terms
Add Translated Languages and Translators
Add supported languages, activate or deactivate a language, assign translators for that language,
and enter translated terms for customizations you've made in your org's default language.
Note: The “Manage Translation” permission is enabled by default in the System Administrator
profile.
1. From Setup, enter Translation Settings in the Quick Find box, then select
Translation Settings.
2. Click Add to activate a new language or Edit to change an existing supported language.
3. If adding a new language, choose a language.
4. To make the entered translations available to your users - select Active. Users can change
their personal language anytime whether or not it's active in the Translation Workbench.
Selecting Active makes the translations available to the users in that language.
Tip: We recommend you don't make a language active until the translators have
translated all values.
5. To assign translators for this language, select them from the Available List and click
Add. If you don’t see the member you want to add, enter keywords in the search box and click
Find.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To add or edit languages:
• Manage Translation
To assign translators:
• Manage Translation
Important: Ensure all translators have the "View Setup and Configuration" permission so that they can begin translating.
Users can only translate languages they're assigned to.
69
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
6. Click Save.
SEE ALSO:
Enable and Disable the Translation Workbench
Translate Terms
Considerations for Updating Translated Terms
Translate Terms
1. From Setup, enter Translate in the Quick Find box, then select Translate.
EDITIONS
2. Select the Language you're translating into.
3. Select a Setup Component. Click the pull-down menu to select from the list of translatable
customizations. See Translatable Customizations for a complete list of possible customizations.
4. Depending on the setup component, select the next options.
The aspect is a part of the setup component that you can translate. For example:
• Workflow tasks have an object (Account, Contact, etc.) and aspect (Subject or Comment).
• Flows have a flow type (Flow and Autolaunched Flow), a flow name, and a flow component
(Definition, Version, Screen Info, Screen Field, and Choice). Flow components can have a
flow version, screen, or aspect.
5. Double click in the translation column to enter new values. You can press TAB to advance to
the next editable field or SHIFT-TAB to go to the previous editable field.
Note: The Out of Date column indicates that the item has been updated and the
term may need translating. When editing a button or link label, you see the Button
or Link Name column, which is used to refer to the component when using the
SOAP API.
6. Click Save.
SEE ALSO:
Considerations for Updating Translated Terms
Add Translated Languages and Translators
70
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To translate terms:
• View Setup and
Configuration
AND
Be designated as a
translator
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Override Translations in Managed Packages
Although you can't edit labels or translations in a managed package, they are controlled by the
developer, you can override them with the Translation Workbench. For example, override a custom
field in a package.
1. From Setup, enter Override in the Quick Find box, then select Override.
2. Select the Package that you’re overriding.
3. Select the Language that you're entering your overrides in.
4. Select a Setup Component. Click the pull-down menu to select from the list of translatable
customizations. See Translatable Customizations for a complete list of possible customizations.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
5. Depending on the setup component, select the next options.
The aspect is a part of the setup component that you can translate. For example:
USER PERMISSIONS
• Workflow tasks have an object (Account, Contact, etc.) and aspect (Subject or Comment).
To override terms:
• View Setup and
Configuration
• Flows have a flow type (Flow and Autolaunched Flow), a flow name, and a flow component
(Definition, Version, Screen Info, Screen Field, and Choice). Flow components can have a
flow version, screen, or aspect.
6. Double click in the override column to enter new values. You can press TAB to advance to the
next editable field or SHIFT-TAB to go to the previous editable field.
AND
Customize Application
Note: The Out of Date column indicates that the item has been updated and the
term may need to be changed. When editing a button or link label, you see the Button
or Link Name column, which is used to refer to the component when using the
SOAP API.
7. Double click in the translation column to enter new values. You can press TAB to advance to the next editable field or SHIFT-TAB to
go to the previous editable field.
Note: The Out of Date column indicates that the item has been updated and the term may need translating. When
editing a button or link label, you see the Button or Link Name column, which is used to refer to the component
when using the SOAP API.
8. Click Save.
SEE ALSO:
Enable and Disable the Translation Workbench
71
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Translatable Customizations
You can translate only certain components.
EDITIONS
To view the translatable customizations in your organization, from Setup, enter Translate in
the Quick Find box, select Translate, and then select a Setup Component. Then, if
needed, select Object, Custom Report Type Entity, or Aspect.
You can translate the following components.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• Action
• Address Country
• Address State
• Apex Sharing Reason
• Button and Link Label
• Custom App
• Custom Field
• Custom Report Type
• Data Category
• Data Category Group
• Division
• Feed Filter
• FieldSet
• Flow
• Global Picklist
• Layout Section
• Lookup Filter
• Navigation Menu Item (for Communities)
• Lookup Filters
• Path Step Rich Text
• Picklist Values
• Quick Action Labels
• Record Type
• Related List Label
• Reputation Levels (for Communities)
• S-Control
• Solution Category
• Standard Field Help
• Validation Error Message
• Web Tabs (which also includes Lightning component and Visualforce tabs)
• Workflow Tasks
Important: Visualforce pages supersede s-controls. Organizations that haven’t previously used s-controls can’t create them.
Existing s-controls are unaffected, and can still be edited.
72
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Flow Components in Translation Workbench
In the Translation Workbench, a flow component is a part of the flow you can translate.
SEE ALSO:
Enable and Disable the Translation Workbench
Flow Components in Translation Workbench
In the Translation Workbench, a flow component is a part of the flow you can translate.
Flow
Component
Description
Where Translation Appears
Definition
The flow name
The flow interview's title bar
Version
The version name The active flow version name is the flow definition name
of a flow
by default, so it appears in the flow interview's title bar.
When you enter the flow definition and its translation
manually, the translated definition name overrides the
active flow version name. When the flow definition name
doesn't have a translation, the translated version name
appears as the flow interview's title.
Screen Info
Aspect includes The help text and paused messages for the overall screen
help text and
paused messages
Screen Field
Aspect includes The field-level text on a screen. The description aspect is
field labels,
the text for output fields.
description, help
text, and error
messages
Choice
Aspect includes
field labels, help
text, input labels
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
The field-level text for choice fields on a screen
Translation Files
Translate customization labels or review translations with Salesforce Translation Format (.stf) or
XML Localization Interchange File Format (.xlf) files.
EDITIONS
• Source: Use to translate labels for the first time.
Available in: both Salesforce
Classic and Lightning
Experience
• Untranslated: Use to translate labels after the first translation pass.
• Bilingual: Use to review and edit translations.
Translation files are identified with either the .stf or .xlf extension. A translation filename
includes the name of the export option used to create it, the language code for the file's content,
and a date stamp.
73
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Multiple .stf or .xlf files created with the Untranslated and Bilingual options are compressed into zip files up to 5 MB in size. If
multiple zip files are needed, the zip filenames are each date stamped and incremented. For example, Untranslated 2010–09–20
05:13 1of2.zip
Warning: Consider the following when editing your .stf files:
• Don't change the .stf file extension.
• If you use tabs, new lines, or carriage returns in your text for translation, notice that they are represented with special characters
in the .stf file format. Tabs are \t, new lines are \n and carriage returns are \r. To ensure consistency between your
language versions, ensure these characters are maintained in your translations.
Working with the Source File
Use the Source file to translate an organization's labels for the first time. The Source file contains labels for all of an organization's
translatable customizations in the organization's default language.
If you aren't using a standard translation tool such as Trados, work with the file using an application that supports tabs and word wrap,
such as WordPad or MS Excel.
Note: If you use MS Excel to enter translations in your .stf file, your file format may be corrupted. MS Excel automatically adds
quotation marks around entries that have commas. We advise you open your files in a text editor before import and remove these
quotation marks if they have been added. The import will fail if these quotation marks are not removed.
To prepare the Source file for your translators:
• Create one copy of the Source file for each language you are translating into.
• In the header of each Source file, change the language code from the organization's default language (such as en_US) to the
translation language (such as fr).
Tell your translators to replace the untranslated values in the LABEL column with translated values.
Note: Don't add columns to or remove columns from the translation file.
Column
Description
Edit Options
KEY
Unique identifiers for labels
Do not edit
LABEL
Labels that are visible to end users
Replace untranslated values with translated
values
Working with the Untranslated File
Use the Untranslated file to translate labels that haven't been translated. One Untranslated file is generated for each language. When
multiple files are generated, they're exported to a .zip file containing .stf files for each translation language.
If you aren't using a standard translation tool such as Trados, work with the file using an application that supports tabs and word wrap,
such as WordPad or MS Excel.
Note: If you use MS Excel to enter translations in your .stf file, your file format may be corrupted. MS Excel automatically adds
quotation marks around entries that have commas. We advise you open your files in a text editor before import and remove these
quotation marks if they have been added. The import will fail if these quotation marks are not removed.
Tell your translators to replace the untranslated values in the LABEL column with translated values.
Note: Don't add columns to or remove columns from the translation file.
74
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Column
Description
Edit Options
KEY
Unique identifiers for labels
Do not edit
LABEL
Labels that are visible to end users
Replace untranslated values with translated
values
Working with the Bilingual File
Use the Bilingual file to review translations, edit labels that have already been translated, and add translations for labels that haven't
been translated. One Bilingual file is generated for each translation language.
The TRANSLATED section of the file contains the text that has been translated and needs to be reviewed. The UNTRANSLATED section
of the file contains text that hasn't been translated.
Edit the file using an editing application that supports tabs and word wrap, such as WordPad or MS Excel.
Note: If you use MS Excel to enter translations in your .stf file, your file format may be corrupted. MS Excel automatically adds
quotation marks around entries that have commas. We advise you open your files in a text editor before import and remove these
quotation marks if they have been added. The import will fail if these quotation marks are not removed.
• Identify labels that are out of date by scrolling through the OUT OF DATE column to locate values that have an asterisk (*). Update
out of date labels as needed.
• Edit translated labels in the TRANSLATION column of the TRANSLATED section.
• Replace untranslated labels with translated values in the LABEL column of the UNTRANSLATED section.
• Delete a translation by replacing the desired value in the TRANSLATION column in either section with a left and right angle bracket
pair (< >). When the Bilingual file is imported, the label reverts to its original value.
Attention: Don't attempt to delete a translation by deleting a translated label from the file. Deleting a translation in the file
doesn't remove the translation from the application after the file is imported.
Note: Don't add columns to or remove columns from the translation file.
Column
Description
Edit Options
KEY
Unique identifiers for labels
Do not edit
LABEL
Labels that are visible to end users
• Do not edit labels in the TRANSLATED
section of the file
• In the UNTRANSLATED section of the file,
replace untranslated labels with translated
values
TRANSLATION
Current translation
• In the TRANSLATED section of the file, edit
current translations
• In the UNTRANSLATED section of the file,
add translations
75
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Column
Description
Edit Options
OUT OF DATE
Indicates whether the source text has changed since Do not edit
the previous translation.
The out of date indicators are:
• An asterisk (*): The label is out of date. A change
was made to the default language label and
the translation hasn't been updated.
• A dash (-): The translation is current.
Translation Files for Flows
In a translation file for the Translation Workbench, a unique key or trans-unit id attribute identifies a flow label.
SEE ALSO:
Exporting Translation Files
Import Translated Files
Translation Files for Flows
Translation Files for Flows
In a translation file for the Translation Workbench, a unique key or trans-unit id attribute identifies
a flow label.
EDITIONS
Flows follow a convention based on the flow label.
Available in: both Salesforce
Classic and Lightning
Experience
Flow
Key or Trans-unit id
Component
Example
Flow
Definition
Name
Flow.flowType.flowUniqueName. Flow.Flow.Survey_customers.FieldLabel
FieldLabel
Flow
Version
Name
Flow.flowType.flowUniqueName. Flow.Flow.Survey_customers.1.Name
versionNumber.Name
Screen
Paused
Message
Flow.flowType.flowUniqueName. Flow.Flow.Survey_customers.1.
Screen.Greet_Customer.PausedText
versionNumber.Screen.
screenUniqueName.PausedText
Help Text
Flow.flowType.flowUniqueName. Flow.Flow.Survey_customers.1.
Screen.Greet_Customer.HelpText
versionNumber.Screen.
screenUniqueName.HelpText
Screen Input Field
76
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Flow
Component
Key or Trans-unit id
Example
Label
Flow.flowType.flowUniqueName.
versionNumber.screenUniqueName.
Field.fieldUniqueName.FieldLabel
Flow.Flow.Survey_customers.2.
Survey_Customer.Field.Customer_Name.FieldLabel
Help Text
Flow.flowType.flowUniqueName.
versionNumber.screenUniqueName.
Field.fieldUniqueName.HelpText
Flow.Flow.Survey_customers.2.
Survey_Customer.Field.Customer_Name.HelpText
Error Message
Flow.flowType.flowUniqueName.
versionNumber.screenUniqueName.
Field.fieldUniqueName.ErrorMessage
Flow.Flow.Survey_customers.2.
Survey_Customer.Field.Customer_Name.ErrorMessage
Screen Output Field
Display Text
Flow.flowType.flowUniqueName.
versionNumber.screenUniqueName.
Field.fieldUniqueName.Description
Flow.Flow.Survey_customers.2.
Greet_Customer.Field.WelcomeMessage.Description
Label
Flow.flowType.flowUniqueName.
versionNumber.Choice.choiceUniqueName.
FieldLabel
Flow.Flow.Survey_customers.2.
Choice.Participate_No.FieldLabel
Error Message
Flow.flowType.flowUniqueName.
versionNumber.Choice.choiceUniqueName.
ErrorMessage
Flow.Flow.Survey_customers.2.
Choice.Participate_No.ErrorMessage
Input Label
Flow.flowType.flowUniqueName.
versionNumber.Choice.choiceUniqueName.
InputLabel
Flow.Flow.Survey_customers.2.
Choice.Participate_No.InputLabel
Choice
SEE ALSO:
Translation Files
Considerations for Translation Workbench
Learn about updating translated terms and translating flows.
EDITIONS
Considerations for Updating Translated Terms
Translators are responsible for keeping the translated terms updated. When translated
components change, the translated value is marked Out of Date.
Available in: both Salesforce
Classic and Lightning
Experience
Considerations for Translating Flows
When you use Translation Workbench to translate flows, take note of these considerations.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
77
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Considerations for Updating Translated Terms
Translators are responsible for keeping the translated terms updated. When translated components
change, the translated value is marked Out of Date.
EDITIONS
For example, say you enter a translation for an error message on a lookup filter. Later, you edit the
lookup filter and change the error message. When you go into the Translation Workbench and view
the message translation column, it still shows the translation for the old error message and the
checkbox in the Out of Date column is selected.
Available in: both Salesforce
Classic and Lightning
Experience
For best results, have your translators check their translations frequently, and be sure to notify them
when changes occur. To generate a list of all the translatable customizations and their associated
Out of Date states, export the translation files.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
SEE ALSO:
Translate Terms
Add Translated Languages and Translators
Considerations for Translating Flows
When you use Translation Workbench to translate flows, take note of these considerations.
EDITIONS
Translating Flows
Available in: both Salesforce
Classic and Lightning
Experience
• You can translate these flow types: Flow, Autolaunched Flow.
• A translation can only reference a merge field (like {!myVar}) if it's referenced in the first 1,000
characters of the master label.
• Translations for flow definition name and version name each have a maximum limit of 255
characters. Other translations for flow labels have a maximum of 1,000 characters.
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
• Text templates and merge field values aren’t supported for translation.
• Right-to-left languages aren’t supported.
• When a flow label isn't translated for a language, we use the translation for the appropriate fallback language. If there's no translated
label in the fallback language, we use the master label.
Updating Flow Translations
What happens when you change a flow that you’ve translated? Salesforce copies as much information as it can when you save changes
to the translated version, create a version, or save as a new flow.
For example, version 1 of the Survey Customers flow has a translation for the WelcomeMessage field. When you save another version
of the flow, Salesforce copies all the latest translations from version 1 to version 2. The same happens if you save it as a new flow.
When you remove a label from a flow, translations aren’t copied. Salesforce uses the label's Unique Name to copy translations to another
version. When you change the Unique Name of a label, the label is as good as deleted.
Note:
• When a flow is deleted, its translations are deleted.
• The Out of Date column in Translation Workbench is supported for only the flow definition name and version name.
78
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Exporting and Importing Flow Translations
• You can export and import translation files to send to translators or to help you translate lengthy text.
• When you export translations, the master labels are truncated after 1,000 characters.
SEE ALSO:
Best Practices for Designing Flows for Translation
Exporting Translation Files
Create files that contain your org’s translatable metadata, such as custom fields, report types, and
picklist values. Send these files to your outside translators or translation agency for bulk translation
activities, then use Import to update your labels.
Note: You need both the Manage Translation AND Create Documents user perms to import
or export translation files. If you attempt either operation without both user perms, you may
be able to navigate to the import or export page, but the operation itself will fail.
1. From Setup, enter Export in the Quick Find box, then select Export.
2. Select which labels you want to export.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• Source–Used as the initial source for creating new translations.
Creates a single file that contains a list of all your translatable customizations. Typically, the
content is in your organization's default language.
• Untranslated–Used to make updates.
Creates a set of files that contain only customizations that have not been translated, including
new and modified customizations.
One file is created for each language. These files are then compressed into .zip files.
USER PERMISSIONS
To export or import
translation files
• Manage Translation
AND
Create Documents
• Bilingual–Used for reference and reviewing all your untranslated and translated
customizations.
Creates a list of all the translatable labels in their current translated or untranslated state.
One file is created for each language. These files are then compressed into .zip files.
The content in each file is divided into Untranslated and Translated sections. Each translatable label is in either the Untranslated
or Translated section, according to its translation state. In the Translated section, out of date status for the labels in included.
3. Click Export.
A status message tells you that the export is being processed. When the export is complete an email is sent to the email address
specified in your profile.
4. Locate the exported .stf, .xlf, or .zip file.
Go to Your name > Documents > Document Folders > My Personal Documents > Go!.
All exported files indicate the Export option used to create them and are date and time stamped. Individual files end with the
extension .stf. Multiple files are grouped into .zip files.
If you have a large number of documents in your personal documents area, you'll find the exported files under the sort letter:
• B—Bilingual export option, for example: Bilingual_2010-09-23_11:20.zip.
79
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
• S—Source export option, for example: Source_en_US_2010-09-23_11:20.stf.
• U—Untranslated export option, for example: Untranslated_2010-09-23_11:20.zip.
5. Save the files for translation by your translators or translation agency.
Click View > Save File > OK. The file is saved to the location specified by your browser. For example,
C:/Users/username/Downloads.
SEE ALSO:
Import Translated Files
Enable and Disable the Translation Workbench
Import Translated Files
Import and update the translations for your org’s metadata, such as custom fields, report types, and
picklist values. Typically, the original files are exported from Salesforce, then sent to your outside
translators or translation agency for bulk translation activities and returned to you for importing.
Note: Labels that are exported and left as is are not saved as translations on import.
1. Bundle multiple files into .zip files that are no larger than 5 MB. Create multiple .zip files as
needed.
The zipped files don't have to be in the same order or grouping as the exported .zip files.
For example, you start with two exported .zip files. The first file includes French, Italian, and
Japanese. The second file includes Russian, Simplified Chinese, and Greek. You can create:
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• One .zip file with French, Greek, and Italian.
USER PERMISSIONS
• One .zip file with Russian and Greek.
To export or import
translation files
• Manage Translation
• One .zip file with Simplified Chinese.
2. From Setup, enter Import in the Quick Find box, then select Import under Translation
Workbench.
3. Click Browse to locate and select the file you want to import.
4. Click Import.
After the import is complete:
• The labels are updated with the translations.
• A confirmation email is sent to the email address specified in your profile.
5. Verify the imported changes have been implemented. You can:
• Check labels in your Salesforce organization.
• Check labels through the Translation Workbench.
SEE ALSO:
Exporting Translation Files
Enable and Disable the Translation Workbench
80
AND
Create Documents
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Common Errors with Exporting and Importing Translation Files
Troubleshoot issues you might encounter while exporting and importing files in the Translation
Workbench.
Error Message
What It Means
Troubleshooting Steps
Bilingual File starts with
non-section header row: {0}
The header rows of the file
you’re trying to import are
missing, or there is extraneous
text (such as notes that aren't
commented out) in those rows.
Export your file again and make
sure there are header rows for
all sections, and that all
extraneous text has been
commented out or removed
from the header rows.
Duplicate key: {0} exists in
import file, please re-export.
The specified key appears in
your imported file more than
once. Each translated item
needs to have its own unique
key, and each key can only
appear in the file one time.
Export your file again and make
sure that each key in it is
unique, and then re-import the
file.
Invalid Key
During translation, Salesforce
generates unique keys, or
identifiers, for each object,
picklist value, or page element
you’re translating. If these
names or keys are changed
after you export your file,
Salesforce can’t match the
correct key with the correct
name.
Export your file again and make
sure the keys in it match those
in the file you’re trying to
import.
Key: {0} could not be uniquely One of the keys in your Custom Export your file again and make
resolved. This is caused by a
Report Type (CRT) column is in sure you’re using the correct
change to our Custom Report the wrong format.
CRT key format.
Type Column key format.
Please re-export and use the
new key format for those keys.
Maximum character limit {x} for Each type of field, such as a
{field type} translation
picklist value, can only have a
exceeded in line:
certain number of characters.
Your translated labels for the
type of field at the line specified
in the error message are too
long.
No data to import
Edit your translated labels so
they’re within the character
limit listed for the field type and
import your file again.
The file you’re trying to import Make sure you’re importing the
is empty or does not contain correct file, and that it contains
any translation changes.
translated data.
81
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Extend Salesforce with Clicks, Not Code
Support Users in Multiple Languages
Error Message
What It Means
Troubleshooting Steps
No language code specified in file header
The file you’re trying to import doesn’t have Make sure your language code is valid and
a valid language code, or the language code isn't missing or commented out.
is in the wrong place.
No translated or untranslated section header The file you’re trying to import is missing
found in the bilingual file
section headers.
No valid file type specified in file header
Make sure your file has section headers and
import it again.
The file you’re trying to import doesn’t have Make sure your file has a valid import/export
a valid import/export type (Source,
type in the file header, and that the header
Untranslated, or Bilingual) specified in the did not get translated.
file header. The file type should be in the
default language for your organization.
Not a valid file to import. Please select a .stf, You can only import files in .stf or .xlf
.xlf, or .zip file for import.
formats. Or .zip files that contain .stf or .xlf
files.
Make sure your file is a .stf, .xlf, or .zip file
and try importing it again.
Some keys are appended with their sort
The order of the picklist values in your
order for uniqueness. Re-export your file and source file don’t match your setup.
ensure that the keys in both files match.
Export your source file and match the order
of the picklist values to your import file, then
import again.
Wrong number of columns in line: {x}. Check The file you’re importing has extra tabs, new Edit your data to remove or escape any extra
that you have escaped tabs (\\t), new lines lines, or carriage returns in the line specified tabs, newlines, or carriage returns, and make
(\\n), and carriage returns (\\r) in your files. in the error message.
sure the file you’re importing has the same
number of columns as the file you exported.
Your export request failed. Please retry or
contact support.
Salesforce had an unexpected problem
while exporting your file.
Contact Salesforce Customer Support.
Your import request failed. Please retry or
contact support.
Salesforce had an unexpected problem
while importing your file.
Contact Salesforce Customer Support.
Your organization does not have language The file you’re trying to import is in a
permissions for {language}.
language you haven’t yet added to the
Translation Workbench.
SEE ALSO:
Exporting Translation Files
Import Translated Files
82
Add the language you want to use to the
Translation Workbench and import your file
again.
Extend Salesforce with Clicks, Not Code
Set Up Your Data Your Way
Best Practices for the Translation Workbench
To make the Translation Workbench most effective, keep these tips in mind.
EDITIONS
• Let translators know which languages they are responsible for translating.
• Notify all translators when new translated components are added to your org.
• Advise users when customizing reports or list views to use filter criteria values in their personal
language. However, if they use the starts with or contains operators, advise them
to choose the language of the filter criteria values they entered.
• When creating a custom report type that will be translated into multiple languages via the
Translation Workbench, we recommend that you set your personal language to match your
org’s default language. This ensures that words that are translated display in the correct language
for translators.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• Salesforce assumes that all customizations are entered in the org’s default language. Global administrators should work together in
the org’s default language.
Set Up Your Data Your Way
Optimize your Salesforce data to fit the unique needs of your users. You can create your own objects
with data that fits together in the ways that make the most sense for you.
Store Information That’s Unique to Your Organization
Create custom objects to store information that’s unique to your organization. Choose whether
your custom objects are searchable, support sharing, or include access to the Bulk API and
Streaming API.
Design Your Own Data Model
Schema Builder provides a dynamic environment for viewing and modifying all the objects and
relationships in your app. This greatly simplifies the task of designing, implementing, and
modifying your data model, or schema. Schema Builder is enabled by default.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
The available customization
options vary according to
which Salesforce Edition you
have.
USER PERMISSIONS
Create Custom Data Sets
Use custom settings to create custom sets of data, or to create and associate custom data for
an org, profile, or user.
To view setup options:
• View Setup and
Configuration
Customize Fields
Customize standard and custom fields to tailor your org to your own unique requirements.
To customize your org:
• Customize Application
Calculate Field Values With Formulas
A formula is an algorithm that derives its value from other fields, expressions, or values. Formulas
can help you automatically calculate the value of a field based on other fields.
Generate Emails From Records
A merge field is a field you can put in an email template, mail merge template, custom link, or formula to incorporate values from
a record. For example, you can place a merge field in an email template so that the greeting includes the recipient’s name rather
than a generic “Hello!”.
83
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Store Information That’s Unique to Your Organization
Create custom objects to store information that’s unique to your organization. Choose whether
your custom objects are searchable, support sharing, or include access to the Bulk API and Streaming
API.
Every custom object is classified as either an Enterprise Application object or a Light Application object.
The difference between these two categories is that Light Application objects don’t support sharing,
access to the Bulk API, or access to the Streaming API.
If you need to track your organization’s usage of each category, create a custom report type with
a primary object of User Licenses and a child object of Custom Object Usage by User License Metrics.
By default, all custom objects are Enterprise Application objects. To make your custom object a
Light Application object, disable Allow Sharing, Allow Bulk API Access, and
Allow Streaming API Access on the object’s detail page.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Manage Custom Objects
Create, customize, edit, delete, or truncate custom objects to extend the functionality that standard objects, like accounts and
contacts, provide.
Track Your Organization’s Custom Object Usage by User License Type
To keep track of how many custom objects your users are assigned to, create a custom report type with the User Licenses and Custom
Object Usage by User License Metrics objects.
Big Objects
View a big object’s field and index details..
Object Relationships Overview
Create relationships to link objects with each other, so that when your users view records, they can also see related data. For example,
link a custom object called “Bugs” to cases to track product defects that are associated with customer cases.
Create Record Types for Custom Objects
Customize Search Layouts for Custom Objects
Custom Object Security
Learn how security settings work together so you can control access to your custom objects with great flexibility.
Notes on Enabling Activities for Custom Objects
Using Custom Related Lists
Viewing Custom Object Lists
SEE ALSO:
Track Your Organization’s Custom Object Usage by User License Type
84
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Manage Custom Objects
Create, customize, edit, delete, or truncate custom objects to extend the functionality that standard
objects, like accounts and contacts, provide.
Note: Your administrator may have created a tab without any help. If you need help to
understand how a tab for a custom object works, contact your administrator.
Your object management settings list the custom objects that are defined for your organization.
From this list, you can:
• Define a custom object.
• Display detailed information about a custom object.
Optional features you can customize include enabling search and reports, tracking activities,
tracking field history, and making the object available for the Salesforce Customer Portal.
• To update the custom object definition, click Edit and update the desired fields.
Note: The Allow Reports, Allow Activities, and Allow Search fields
are not locked in Managed - Released and can be changed by the developer in future
releases of a managed package.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Managed Packages are not
available in Database.com.
USER PERMISSIONS
To create and edit custom
objects:
• Customize Application
• To delete a custom object, click Del.
• To truncate a custom object, click Truncate.
• To view deleted custom objects, click the Deleted Objects link. The total number of deleted
custom objects for your organization is listed in parentheses.
The detail page of the custom object provides information about various characteristics of the object, including standard fields, custom
fields, field history tracking, relationships, custom links, search layouts, page layouts, and object limits. You can:
• Click individual items to display additional detail.
• To delete a custom field, click Del next to its name in the Custom Fields & Relationships section.
• Click More at the bottom of the page or View More below a related list to display more items.
• Click New to directly add new items.
Note: The object limit percentages are truncated, not rounded. For example, if your org uses 95.55% of the limit for a particular
customization, the object limit displays 95%.
Deployment Status for Custom Objects and External Objects
Define a Custom Object
Track and store data that’s unique to your organization. Follow different steps, depending on which Salesforce experience you’re
using.
Modify Custom Objects
Define Custom Object Fields
Delete Custom Objects
Manage Deleted Custom Objects
Truncating Custom Objects
It’s important to understand what truncating an object does before using it to remove records.
85
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Truncate Custom Objects
Truncating custom objects allows you to permanently delete all of the object’s records but preserve the empty object and its
metadata.
SEE ALSO:
Make Search Faster
Store Information That’s Unique to Your Organization
Find Object Management Settings
Deployment Status for Custom Objects and External Objects
While developing a custom object or external object, you might not want users to see and interact
with it. Because users might get frustrated with changes in layout or lose data when you delete
custom fields, control visibility of the new object until you are finished.
Use the Deployment Status setting in the object definition to control when users can see
and use the object and its associated custom tab, related lists, and reports.
• Choose “In Development” as the Deployment Status when first creating your custom
object or external object. Doing so hides it from users while you are designing and testing it.
Only users with the “Customize Application” permission can see the object tab, search results,
related lists, and report data types.
• Change the Deployment Status to “Deployed” when you want to allow all users to use
the object and any associated custom tab, related lists, and reports.
• If you make more enhancements after deploying a custom object or external object, you can
change the Deployment Status back to “In Development.”
Note: A custom report type’s Deployment Status changes from Deployed to In
Development if its primary object is a custom or external object whose Deployment
Status similarly changes.
SEE ALSO:
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Salesforce Connect external
objects are available in:
Developer Edition and for
an extra cost in: Enterprise,
Performance, and
Unlimited Editions
USER PERMISSIONS
Make Search Faster
To deploy custom objects
and external objects:
• Customize Application
Define a Custom Object
Track and store data that’s unique to your organization. Follow different steps, depending on which Salesforce experience you’re using.
Define a Custom Object in Lightning Experience
Track and store data that’s unique to your organization. If you see the App Launcher icon ( ) on the left side of the navigation bar
at the top of your screen, you're in Lightning Experience. If not, you're in Salesforce Classic.
Define a Custom Object in Salesforce Classic
Track and store data that’s unique to your org.
Fields for Defining Custom Objects
When you create a custom object, several fields are required to define how you can access the object.
86
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Considerations for Creating Custom Objects
Before you create a custom object, make sure that you’ve reviewed the considerations.
SEE ALSO:
Make Search Faster
Object Relationships Overview
Define Object-Level Help
Define a Custom Object in Lightning Experience
Track and store data that’s unique to your organization. If you see the App Launcher icon ( ) on
the left side of the navigation bar at the top of your screen, you're in Lightning Experience. If not,
you're in Salesforce Classic.
1. From the top right corner of any page in Setup, click Create > Custom Object.
2. Complete the fields for your custom object.
EDITIONS
Available in: Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
3. Save the new object.
SEE ALSO:
Fields for Defining Custom Objects
Considerations for Creating Custom Objects
USER PERMISSIONS
Define a Custom Object
To create and edit custom
objects:
• Customize Application
Define a Custom Object in Salesforce Classic
Track and store data that’s unique to your org.
EDITIONS
1. From Setup, enter Objects in the Quick Find box, then select Objects.
Available in: Salesforce
Classic
2. Click New Custom Object.
3. Follow the wizard to complete the fields for your custom object.
4. Save the new object.
SEE ALSO:
Fields for Defining Custom Objects
Considerations for Creating Custom Objects
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
Define a Custom Object
To create and edit custom
objects:
• Customize Application
87
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Fields for Defining Custom Objects
When you create a custom object, several fields are required to define how you can access the
object.
Note: If an administrator created a tab without including help, contact your administrator
if you need help with how a custom object works.
Field
Description
Label
This name is used to refer to the object in a user
interface page.
Plural Label
The plural name of the object. If you create a
tab for this object, this name is used for the tab.
Gender
If it is appropriate for your organization’s default
language, specify the gender of the label. This
field appears if the organization-wide default
language expects gender. Your personal
language preference setting does not affect
whether the field appears. For example, if the
organization’s default language is English and
your personal language is French, you aren’t
prompted for gender when creating a custom
object.
Starts with a vowel sound
If it is appropriate for your organization’s default
language, indicate whether the label is preceded
by “an” instead of “a.”
Object Name
A unique name used to refer to the object when
using the API. In managed packages, this name
prevents naming conflicts with package
installations. Use only alphanumeric characters
and underscores. The name must begin with a
letter and have no spaces. It cannot end with
an underscore nor have two consecutive
underscores.
Description
An optional description of the object. A
meaningful description helps you remember
the differences between your custom objects
when you are viewing them in a list.
Context-Sensitive Help Setting Defines what displays when a user clicks Help
for this Page from the custom object record
home (overview), edit, and detail pages, list
views, and related lists.
To display the standard Salesforce help available
for any custom object record, select Open the
standard Salesforce Help & Training
window.
88
EDITIONS
Available in: Lightning
Experience and Salesforce
Classic
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Extend Salesforce with Clicks, Not Code
Field
Store Information That’s Unique to Your Organization
Description
To display custom object-level help for your custom object, select
Open a window using a Visualforce page and then select the
Visualforce page to use as the target of the context-sensitive help
link from that custom object’s pages.
Note: This setting doesn’t affect the Help & Training link
at the top of a page. That link always opens the Salesforce
Help & Training window.
Record Name
The name used in page layouts, list views, related lists, and search
results.
Data Type
The type of field (text or auto-number) for the record name. Records
that have unique IDs instead of names are auto-numbered and
always a read-only field.
Display Format
For an auto-numbered record name, enter the display format. You
can have up to two sets of curly braces. For more information, see
Custom Field Attributes on page 145.
Starting Number
For an auto-numbered record name, enter the number to use
when creating your first record for this custom object.
Allow Reports
Makes the data in the custom object records available for reporting
purposes.
To create reports on custom objects, choose the Other Reports
report type category, unless the custom object has a relationship
with a standard object. When the custom object has a master-detail
relationship with a standard object or is a lookup object on a
standard object, select the standard object for the report type
category instead.
Allow Activities
Allows users to associate tasks and scheduled calendar events
related to the custom object records.
Allow in Chatter Groups
Allows users to add records of this custom object type to Chatter
groups.
When true, users with permissions can create records of this
object type using the group publisher. The created record is
associated with the group and appears in the group record list.
When false, users with permissions can use the group publisher
to create records of this object type, but the record is not associated
with the group.
Enable Divisions
If your organization has divisions enabled, select this option to
enable the custom object for divisions. Divisions group records for
simplified search results, list views, reports, and other areas within
Salesforce. Salesforce adds a Division field to the custom
object. If the custom object is the master in a master-detail
89
Extend Salesforce with Clicks, Not Code
Field
Store Information That’s Unique to Your Organization
Description
relationship, custom objects on the detail side also get the
Division field and inherit their division from the master record.
Available for Customer Portal
Makes the custom object available to all portal users.
This option is available only if your organization has a customer
portal.
If you enable Communities in your organization, this option no
longer appears, and all custom objects are available in your
communities. If, before enabling Communities, you had a Customer
Portal and custom objects without this option selected, those
objects become available in your Customer Portal.
Track Field History
Enables your organization to track changes to fields on the custom
object records. For example, it tracks who changed the field value
and when, what the value was before the edit, and what it was
changed to. History data is available for reporting, so users can
easily create audit trail reports when this feature is enabled.
Allow Sharing
When this setting is enabled, the custom object is an Enterprise
Application object. When this setting isn’t enabled, the custom
object is a Light Application object.
When this setting is enabled, you must also enable Allow Bulk
API Access and Allow Streaming API Access.
Allow Bulk API Access
When this setting is enabled, the custom object is an Enterprise
Application object. When this setting isn’t enabled, the custom
object is a Light Application object.
When this setting is enabled, you must also enable Allow
Sharing and Allow Streaming API Access.
Allow Streaming API Access
When this setting is enabled, the custom object is an Enterprise
Application object. When this setting isn’t enabled, the custom
object is a Light Application object.
When this setting is enabled, you must also enable Allow Bulk
API Access and Allow Sharing.
Deployment Status
Indicates whether the custom object is visible to other users.
Allow Search
To allow your users to find a custom object’s records when they
search, create a custom tab set to Default On or Default Off.
Creating a custom tab enables the custom object's Allow Search
setting.
Custom object records are searchable in the Salesforce user
interface only if the custom object is associated with a custom tab.
Users aren't required to add the tab for display.
90
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Field
Description
Add Notes & Attachments...
Allows users to attach notes and attachments to custom object
records. You can attach external documents to any object record
in much the same way that you can add a PDF file or photo as an
attachment to an email.
This option is available only when you are creating a new object.
Launch the New Custom Tab Wizard
Starts the custom tab wizard after you save the custom object.
SEE ALSO:
Define a Custom Object
Considerations for Creating Custom Objects
Before you create a custom object, make sure that you’ve reviewed the considerations.
EDITIONS
Object Creation
• Establish object relationships first before adding all custom fields, page layouts, and related
lists.
• The standard Name field is required on custom object related lists and page layouts.
• Provide meaningful names for your custom objects. The plural label of the custom object
is used as the label of the custom tab based on that object.
Object Permissions
In Enterprise, Unlimited, Performance, Professional, and Developer Editions, when you create
a custom object, the “Read,” “Create,” “Edit,” and “Delete” permissions for that object are disabled
for profiles that have “View All Data” or “Modify All Data” disabled. Enable access to custom
objects in permission sets or custom profiles, and assign them to the users who need access.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
In Contact Manager and Group Editions, when you create a custom object, the “Read,” “Create,” “Edit,” and “Delete” permissions for
that object are enabled for all profiles.
Sharing Model
An org-wide default setting controls the data sharing model for custom objects. For more information, see Custom Object Security
on page 111.
Delegating Custom Object Administration
After you create a custom object, you can delegate its administration to non-admin users.
Queues
After you create a custom object, you can define queues to distribute ownership of custom object records to your users.
SEE ALSO:
Define a Custom Object
91
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Modify Custom Objects
Customize the user interface for your custom objects by:
EDITIONS
• Creating a custom tab (see Show Custom Object Data for Your Users)
• Creating custom fields and relationships (see Define Custom Object Fields on page 92)
• Adding customized buttons and links to perform actions or link to other pages or websites (see
Define Custom Buttons and Links on page 962)
• Defining which fields display for users on record detail and edit pages (see Build Page Layouts
for Custom Objects on page 32)
• Specifying which fields display for users in search results, lookup dialogs, and in the key lists on
custom object tabs (see Customize Search Layouts for Custom Objects on page 111)
• Creating record types to display different picklist values and page layouts to different users
based on their profiles (see Create Record Types for Custom Objects on page 110)
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
To customize custom
objects:
• Customize Application
Define Custom Object Fields
Custom object fields store the data for your custom object records.
Custom Fields for Custom Objects
You can create custom fields to store information unique to your organization. You can also
create custom relationship fields to associate your custom object with another object in
Salesforce.
Standard Fields for Custom Objects
Custom objects automatically include the following standard fields. Click Edit to modify any
of the editable fields.
Field
Description
Created By
User who created the record.
Currency
Currency of the record if multicurrency is
enabled.
Division
Division to which the custom object record
belongs. Custom objects that are “detail” objects
in a master-detail relationship inherit their
division from the master object. Custom objects
that are not related to other records are
automatically in the global division. Available
only in organizations that use divisions to
segment their data.
Last Modified By
User who most recently changed the record.
Name
Identifier for the custom object record. This
name appears in page layouts, related lists,
92
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Divisions are not available
in Database.com.
USER PERMISSIONS
To view and edit standard
fields:
• Customize Application
To create custom fields:
• Customize Application
Extend Salesforce with Clicks, Not Code
Field
Store Information That’s Unique to Your Organization
Description
lookup dialogs, search results, and key lists on tab home pages. By
default, this field is added to the custom object page layout as a
required field.
Owner
Assigned owner of the custom object record. If the custom object
becomes the detail side of a master-detail relationship, this field is
removed, as ownership of the data is controlled by the master
object, or by the primary master object for a custom object with
two master-detail relationships.
Note: Custom objects on the “detail” side of a master-detail
relationship can't have sharing rules, manual sharing, or
queues, as these require the Owner field.
Delete Custom Objects
When you delete a custom object, Salesforce does not add it to the Recycle Bin. Instead, deleted
objects appear in the Deleted Objects list for 15 days. During this time, the object and its data are
soft deleted, meaning you can restore or permanently erase (hard delete) the object and its data.
After 15 days, the object and its data are automatically hard deleted.
Soft-deleted custom objects and their data count against your organization’s limits; hard-deleted
items do not.
To delete a custom object:
1. From the object management settings for custom objects, click Del next to object that you
want to delete.
2. When prompted, select the Yes, I want to delete the custom object
checkbox to confirm and click Delete.
EDITIONS
Available in: Salesforce
Classic
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
USER PERMISSIONS
To delete custom objects:
• Customize Application
Why Can’t I Delete a Certain Custom Object?
You can’t delete a custom object if it:
• Is on the master side of a master-detail relationship.
• Contains custom fields that are used in a roll-up summary field on another object.
• Is referenced in Apex, a Visualforce page, or an reporting snapshot.
• Is referenced by a duplicate rule or a matching rule.
• Contains more than 100,000 records. If the object you want to delete has more than 100,000 records, first delete an appropriate
number of records and then delete the object.
Results of Deleting Custom Objects
When you delete a custom object, Salesforce:
• Displays an Insufficient Privileges message if someone clicks a bookmark to a deleted custom object record’s URL.
• Removes the object from Force.com AppExchange packages.
• Changes the master-detail relationship to a lookup relationship, if the deleted object is on the detail side of a master-detail relationship.
93
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
• Removes or erases:
– The object’s custom tab
– List views and workflow rules for the object
– Mobile configuration settings, including data sets, mobile views, and excluded fields
– Standard report types associated with the object, and reports based on standard report types if the deleted object is on the
detail side of a master-detail relationship
• Hides, inactivates, or disables:
– The custom object definition and related definitions
– The object’s records and related records, including any records in the Recycle Bin
– Custom report types for which the deleted object is the main object
– Custom reports for which the deleted object is the main object
– Custom formula fields on the object
– Custom validation rules and approval processes on the object
Note: Many removed, hidden, inactive, or disabled items can be restored if you undelete the custom object. See Manage Deleted
Custom Objects for information about restoring deleted custom objects.
Results of Hard Deleting Custom Objects
When a custom object is hard deleted, either manually, or automatically after 15 days:
• The custom object’s definition and data are permanently deleted, and can’t be restored.
• The custom object and its data no longer count against your organization’s limits.
• If the deleted object is on the detail side of a master-detail relationship, master records currently in the Recycle Bin aren’t restorable
if one or more detail records were automatically deleted as a result of the master record being deleted. Attempting to undelete the
master record results in an error.
Note: This only happens when the deleted detail records have their custom object definition hard deleted while the master
record is in the Recycle Bin.
SEE ALSO:
Manage Deleted Custom Objects
Find Object Management Settings
94
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Manage Deleted Custom Objects
Deleted custom objects appear in the Deleted Objects list for 15 days. During this time, you can
choose to permanently delete the object and its data, or you can undelete them. If you undelete
a custom object, you might need to do some manual cleanup to restore list views and other
customizations that use the object.
• To view a list of deleted custom objects:
1. Go to the object management settings for custom objects.
2. Click Deleted Objects at the bottom of the list.
The Deleted Objects link appears only when you have at least one deleted custom object in
your organization. The number in parentheses indicates the total number of deleted custom
objects.
EDITIONS
Available in: Salesforce
Classic
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
USER PERMISSIONS
• In the Deleted Objects list, you can do any of the following:
– Click the object’s label to view details about it
– Click Erase to permanently remove the object and its data
– Click Undelete to restore the object and its data
To restore deleted custom
objects:
• Customize Application
To permanently delete
custom objects:
• Customize Application
Results of Hard Deleting Custom Objects
When a custom object is hard deleted, either manually, or automatically after 15 days:
• The custom object’s definition and data are permanently deleted, and can’t be restored.
• The custom object and its data no longer count against your organization’s limits.
• If the deleted object is on the detail side of a master-detail relationship, master records currently in the Recycle Bin aren’t restorable
if one or more detail records were automatically deleted as a result of the master record being deleted. Attempting to undelete the
master record results in an error.
Note: This only happens when the deleted detail records have their custom object definition hard deleted while the master
record is in the Recycle Bin.
Limitations for Restoring Truncated Custom Objects
Copies of truncated custom objects also appear in the list of deleted objects. Truncated custom objects can’t be restored to their original
state. Undeleted copies of truncated objects have a new name and new URL, and some fields and data cannot be manually restored.
Restoring a Custom Object to Its Predeleted State
When you restore a deleted custom object, its records are also undeleted, including any that were in the Recycle Bin.
Note: It might take several hours before you can search the undeleted object’s records.
To ensure that you return the object to its fully functional, predeleted state, check all affected conditions and customizations, and
manually fix them if necessary.
AppExchange packages
Add the custom object to any appropriate Force.com AppExchange packages.
Custom tabs
Re-create a custom tab for the object and add it to any custom apps that use it.
95
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
List views, reports, and workflow rules
Re-create them.
Validation rules and approval processes
Re-activate them.
Formula fields
Open and save any custom formula fields on the object to re-enable them.
Page layouts
Page layouts are restored automatically on the undeleted object. Page layouts are also restored automatically on other objects that
use the page layout in a related list—as long as the page layout wasn’t edited while the object was deleted. Otherwise, you have
to add the related list back to the other object.
Custom report types
For custom report types where the deleted object was not the main object, add the reference back to the restored object. Reports
based on the custom report type are automatically restored if they weren’t edited while the object was deleted. Re-create any reports
that have been edited.
Relationships
If the deleted custom object was on the detail side of a master-detail relationship, Salesforce converted it to a lookup relationship.
Change it back to master-detail.
Developer name
The developer name for the object was changed to objectname_del. Change it back to the original name, objectname_c,
so that customizations using the name will work properly.
Deployment status
When the custom object was deleted, its Deployment Status field was set to In Development. When you’ve restored all
affected customizations to the undeleted object, change its status back to Deployed.
SEE ALSO:
Delete Custom Objects
Truncating Custom Objects
Find Object Management Settings
Truncating Custom Objects
It’s important to understand what truncating an object does before using it to remove records.
Truncating a custom object lets you remove all of the object’s records, while keeping the object
and its metadata. Truncating custom objects is similar to the mass delete option available for
standard objects.
When you truncate a custom object, all of the object’s records are removed permanently, but the
object’s definition remains. The records no longer count against your org limits.
In contrast, if you delete a custom object, the object moves to the Deleted Objects list for 15 days.
After that the object and its records are permanently deleted.
Important: Truncated custom objects can’t be restored to their original state.
You can’t truncate standard objects or custom objects that:
• Are referenced by another object through a lookup field or that are on the master side of a
master-detail relationship
96
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
• Are referenced in a reporting snapshot
• Have a custom index or an external ID
• Have activated skinny tables
In addition, you can’t truncate custom objects when your org has reached its limit on allowed custom objects.
Truncating a custom object erases:
• All records currently sitting in the custom object’s Recycle Bin
• The custom object’s history
• Related events, tasks, notes, and attachments for each deleted record
Truncating a custom object breaks:
• Bookmarks to the truncated objects and its records. If someone clicks a bookmark to the truncated custom object or to a deleted
record’s URL, Salesforce displays an Insufficient Privileges message.
• Apex scripts and Visualforce pages with references to a truncated object or record.
After truncating a custom object, you can continue to use the custom object and add new records. Salesforce preserves:
• The custom object definition and all related definitions
• Workflow rules, actions, and triggers
• Sharing rules associated with the custom object
• Validation rules and approval processes
• Master-detail relationships and formula fields
• Translations
• Mobile configuration settings
When working with truncated objects, keep in mind:
• The truncated object tab has a new URL, so new bookmarks need to be created.
• List views and reports need to be refreshed after truncation.
• Roll-up summary fields need to be recalculated after truncation.
• There is no support for truncation in the API.
• To truncate objects that contain master-detail relationships, first truncate the detail (child) objects and then the (master) parent
objects, working your way up the relationship tree.
SEE ALSO:
Truncate Custom Objects
Manage Deleted Custom Objects
97
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Truncate Custom Objects
Truncating custom objects allows you to permanently delete all of the object’s records but preserve
the empty object and its metadata.
Important: Truncating custom objects causes some irreversible changes to the truncated
object and its records. Before truncating, see Truncating Custom Objects. Then, enable it for
your organization by entering User Interface in the Quick Find box, selecting
User Interface, and then selecting the permission.
Truncating custom objects is a fast way to permanently remove all of the records from a custom
object, while keeping the object and its metadata intact for future use. Truncating is useful, for
example, if you have created a custom object and filled it with test records. When you’re done with
the test data, you can truncate the object to purge the test records, but keep the object and put it
into production. This is much faster than batch-deleting records and possibly recreating the object.
EDITIONS
Available in: Salesforce
Classic
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
1. Go to the object management settings for custom objects.
USER PERMISSIONS
2. Click an object name to go to the object’s detail page, and then click Truncate.
To truncate custom objects:
• Customize Application
3. In the Confirm Custom Object Truncate window, review the warning and then enter the name
of the object to truncate in the empty field.
4. Click Truncate.
SEE ALSO:
Manage Deleted Custom Objects
Find Object Management Settings
98
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Track Your Organization’s Custom Object Usage by User License Type
To keep track of how many custom objects your users are assigned to, create a custom report type
with the User Licenses and Custom Object Usage by User License Metrics objects.
EDITIONS
1. From Setup, enter Report Types in the Quick Find box, then select Report Types.
Available in: both Salesforce
Classic and Lightning
Experience
2. Click New Custom Report Type.
3. Fill out the fields.
For this field...
Enter or select...
Primary Object
User Licenses
Report Type Label
A label for this report type. The label appears
when users create a report.
For example, Custom Object Usage
by User License.
Report Type Name
A unique name for this report type.
Description
A description for this report type. This
description appears when users create a
report.
Store in Category
Custom objects are
available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Custom report types are
available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create or update custom
report types:
• Manage Custom Report
Types
Other Reports
4. (Optional) To make this report type available to other users, select a Deployment Status
of Deployed.
5. Click Next.
To delete custom report
types:
• Modify All Data
6. Click the box under the primary object.
7. Select Custom Object Usage by User License Metrics.
8. Click Save.
9. Create a report using the new report type.
Big Objects
View a big object’s field and index details..
EDITIONS
Each custom big object requires a defined index. The order in which the fields are defined are
reflected in the index. It’s recommended that you design your key with the most frequently used
filter parameter as the first element of the index.
Big Object Definition Details
View the definition of a big object’s index in the Setup UI.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
99
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Big Object Definition Details
View the definition of a big object’s index in the Setup UI.
EDITIONS
The big object definition details page displays information about the big object’s fields and index.
Available in: both Salesforce
Classic and Lightning
Experience
Field Name
Description
Field Label
Field name as displayed in the UI.
API Name
Unique API name of a field.
Data Type
The field’s data type.
Indexed
Shows whether or not the field is a part of the big object’s index.
Index Position
Shows the field’s position in the index.
Index Direction
Shows the field’s sort direction in the index.
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
Object Relationships Overview
Create relationships to link objects with each other, so that when your users view records, they can
also see related data. For example, link a custom object called “Bugs” to cases to track product
defects that are associated with customer cases.
You can define different types of relationships by creating custom relationship fields on an object.
Before you begin creating relationships, determine the type of relationship that suits your needs.
Different types of relationships between objects in Salesforce determine how they handle data
deletion, sharing, and required fields in page layouts. Let’s review the types of relationships.
Master-detail
Closely links objects together such that the master record controls certain behaviors of the
detail and subdetail record. For example, you can define a two-object master-detail relationship,
such as Account—Expense Report, that extends the relationship to subdetail records, such as
Account—Expense Report—Expense Line Item. You can then perform operations across the
master—detail—subdetail relationship.
EDITIONS
Available in: Salesforce
Classic
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Tip: Create a master-detail relationship before a custom object contains data.
Behaviors of master-detail relationships:
• Deleting a detail record moves it to the Recycle Bin and leaves the master record intact; deleting a master record also deletes
related detail and subdetail records. Undeleting a detail record restores it, and undeleting a master record also undeletes related
detail and subdetail records. However, if you delete a detail record and later, separately, delete its master record, you cannot
undelete the detail record, as it no longer has a master record to relate to.
• By default, records can’t be reparented in master-detail relationships. Administrators can, however, allow child records in
master-detail relationships on custom objects to be reparented to different parent records by selecting the Allow
reparenting option in the master-detail relationship definition.
• The Owner field on the detail and subdetail records is not available and is automatically set to the owner of the master record.
Custom objects on the “detail” side of a master-detail relationship can't have sharing rules, manual sharing, or queues, as these
require the Owner field.
• Detail and subdetail records inherit security settings and permissions from the master record. You can’t set permissions on the
detail record independently.
100
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
• The master-detail relationship field (which is the field linking the objects) is required on the page layout of the detail and subdetail
records.
• The master object can be a standard object, such as Account or Opportunity, or a custom object.
• As a best practice, don't exceed 10,000 child records for a master-detail relationship.
• Each custom object can have up to two master-detail relationships and up to 25 total relationships.
• The Related To entry can’t be changed after you save the relationship.
Many-to-many
You can use master-detail relationships to model many-to-many relationships between any two objects. A many-to-many relationship
allows each record of one object to be linked to multiple records from another object and vice versa. For example, you create a
custom object called “Bug” that relates to the standard case object such that a bug could be related to multiple cases and a case
could also be related to multiple bugs.
Lookup
Links two objects together. Lookup relationships are similar to master-detail relationships, except they do not support sharing or
roll-up summary fields. With a lookup relationship, you can:
• Link two different objects.
• Link an object with itself (with the exception of the user object; see Hierarchical on page 102). For example, you might want to
link a custom object called “Bug” with itself to show how two different bugs are related to the same problem.
Note: Lookup relationships from objects related to the campaign member object aren’t supported; however, you can create
lookup relationships from the campaign member object related to other objects.
When you create a lookup relationship, you can set these options:
• Make the lookup field required for saving a record, requiring it on the corresponding page layout as well.
• If the lookup field is optional, you can specify one of three behaviors to occur if the lookup record is deleted:
– Clear the value of this field This is the default. Clearing the field is a good choice when the field does not
have to contain a value from the associated lookup record.
– Don’t allow deletion of the lookup record that’s part of a lookup relationship
This option restricts the lookup record from being deleted if you have any dependencies, such as a workflow rule, built on
the relationship.
– Delete this record also Available only if a custom object contains the lookup relationship, not if it’s contained
by a standard object. However, the lookup object can be either standard or custom. Choose when the lookup field and its
associated record are tightly coupled and you want to completely delete related data. For example, say that you have an
expense report record with a lookup relationship to individual expense records. When you delete the report, you probably
want to delete all the expense records, too.
Warning: Choosing Delete this record also can result in a cascade-delete. A cascade-delete bypasses
security and sharing settings, which means users can delete records when the target lookup record is deleted even if
they don’t have access to the records. To prevent records from being accidentally deleted, cascade-delete is disabled by
default. Contact Salesforce to get the cascade-delete option enabled for your organization.
Cascade-delete and its related options are not available for lookup relationships to business hours, community, lead,
price book, product, or user objects.
When you define a lookup relationship, you can include a lookup field on the page layouts for that object as well as create a related
list on the associated object's page layouts. For example, if you have a custom object called “PTO Requests” and you want your users
to link a PTO request with the employee submitting the request, create a lookup relationship from the PTO Request custom object
with the user object.
101
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
If the parent record in a lookup relationship is deleted, the field history tracking for the child record does not record the deletion.
For example, if a parent account is deleted, the Account History related list for the child account does not show the deletion.
You can't delete an object or record in a lookup relationship if the combined number of records between the two linked objects is
more than 100,000. To delete an object or record in a lookup relationship, first delete an appropriate number of its child records.
External lookup
An external lookup relationship links a child standard, custom, or external object to a parent external object. When you create an
external lookup relationship field, the standard External ID field on the parent external object is matched against the values of the
child’s external lookup relationship field. External object field values come from an external data source.
Indirect lookup
An indirect lookup relationship links a child external object to a parent standard or custom object. When you create an indirect
lookup relationship field on an external object, you specify the parent object field and the child object field to match and associate
records in the relationship. Specifically, you select a custom unique, external ID field on the parent object to match against the child’s
indirect lookup relationship field, whose values come from an external data source.
Hierarchical
A special lookup relationship available for only the user object. It lets users use a lookup field to associate one user with another that
does not directly or indirectly refer to itself. For example, you can create a custom hierarchical relationship field to store each user's
direct manager.
Tip: When creating a hierarchical field in Personal, Contact Manager, Group, and Professional Editions, you can select the
Restricted Field checkbox so that only users with the “Manage Internal Users” permission can edit it. In Professional, Enterprise,
Unlimited, Performance, and Developer Edition, use field-level security instead.
Create a Many-to-Many Relationship
Considerations for Relationships
SEE ALSO:
Considerations for Relationships
External Object Relationships
Create a Many-to-Many Relationship
Define a Custom Object
102
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Create a Many-to-Many Relationship
You can use master-detail relationships to model many-to-many relationships between any two
objects. A many-to-many relationship allows each record of one object to be linked to multiple
records from another object and vice versa. For example, you create a custom object called “Bug”
that relates to the standard case object such that a bug could be related to multiple cases and a
case could also be related to multiple bugs. When modeling a many-to-many relationship, you use
a junction object to connect the two objects you want to relate to each other.
Junction Object
A custom object with two master-detail relationships. Using a custom junction object, you can
model a “many-to-many” relationship between two objects. For example, you create a custom
object called “Bug” that relates to the standard case object such that a bug could be related to
multiple cases and a case could also be related to multiple bugs.
Creating the many-to-many relationship consists of:
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Reports are not available in
Database.com.
1. Creating the junction object.
2. Creating the two master-detail relationships.
3. Customizing the related lists on the page layouts of the two master objects.
USER PERMISSIONS
4. Customizing reports to maximize the effectiveness of the many-to-many relationship.
To create a many-to-many
relationship:
• Customize Application
Creating the Junction Object
1. Create a custom object to be your junction object.
2. In the custom object wizard, consider these tips specifically for junction objects:
• Name the object with a label that indicates its purpose, such as BugCaseAssociation.
• For the Record Name field, it is recommended that you use the auto-number data type.
• Do not launch the custom tab wizard before clicking Save. Junction objects do not need a tab.
Creating the Two Master-Detail Relationships
To create the two master-detail relationships:
1. Verify that the two objects you want to relate to each other already exist. For example, you may want to relate the standard case
object to a custom bug object.
2. On the junction object, create the first master-detail relationship field. In the custom field wizard:
a. Choose Master-Detail Relationship as the field type.
b. Select one of the objects to relate to your junction object. For example, select Case.
The first master-detail relationship you create on your junction object becomes the primary relationship. This affects the following
for the junction object records:
• Look and feel: The junction object's detail and edit pages use the color and any associated icon of the primary master object.
• Record ownership: The junction object records inherit the value of the Owner field from their associated primary master
record. Because objects on the detail side of a relationship do not have a visible Owner field, this is only relevant if you later
delete both master-detail relationships on your junction object.
• Division: If your organization uses divisions to segment data, the junction object records inherit their division from their
associated primary master record. Similar to the record ownership, this is only relevant if you later delete both master-detail
relationships.
103
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
c. Select a Sharing Setting option. For master-detail relationship fields, the Sharing Setting attribute determines
the sharing access that users must have to a master record to create, edit, or delete its associated detail records.
d. For the Related List Label that will display on the page layout of the master object, do not accept the default. Change
this to use the name of the other master object in your many-to-many relationship. For example, change this to Bugs so users
will see a Bugs related list on the case detail page.
3. On the junction object, create the second master-detail relationship. In the custom field wizard:
a. Choose Master-Detail Relationship as the field type.
b. Select the other desired master object to relate to your junction object. For example, select Bug.
The second master-detail relationship you create on your junction object becomes the secondary relationship. If you delete the
primary master-detail relationship or convert it to a lookup relationship, the secondary master object becomes primary.
c. Select a Sharing Setting option. For master-detail relationship fields, the Sharing Setting attribute determines
the sharing access that users must have to a master record to create, edit, or delete its associated detail records.
d. For the Related List Label that will display on the page layout of the master object, do not accept the default. Change
this to use the name of the other master object in your many-to-many relationship. For example, change this to Cases so
users will see a Cases related list on the bug detail page.
Customizing Many-to-Many Relationship Related Lists
For a many-to-many relationship in Salesforce, each master object record displays a related list of the associated junction object records.
To create a seamless user experience, you can change the name of the junction object related list on each of the master object page
layouts to have the name of the other master object. For example, you might change the BugCaseAssociations related list to Cases
on the bugs page layout and to Bugs on the cases page layout. You can further customize these related lists to display fields from the
other master object.
To customize the fields that display in the junction object related list on each master object page layout:
1. Edit the page layout of each master object that is related to the junction object. For example, modify the BugCaseAssociations related
list for case records by editing the page layout for cases.
2. Edit the properties of the related list you want to modify. For example, on cases the BugCaseAssociations related list was renamed
to Bugs, so select the Bugs related list.
3. Add the fields to display in the related list. You can add fields from the junction object itself, but more importantly, you can add fields
from the other master object.
Each field is prefixed with its object name in the popup window. In the related list itself, only fields from the junction object are
prefixed with the object name; fields from the other master object are not.
Note: The junction object related list does not include an icon on the master record's detail pages because the junction object
does not have a custom tab. If you make a tab for the junction object, the icon is included.
Customizing Reports for Many-to-Many Relationships
Many-to-many relationships provide two standard report types that join the master objects and the junction object. The report types
are:
• “Primary master with junction object and secondary master” in the primary master object's report category.
• “Secondary master with junction object and primary master” in the secondary master object's report category.
The order of the master objects in the report type is important. The master object listed first determines the scope of records that can
be displayed in the report.
104
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
You can create custom reports based on these standard report types. In addition, you can create custom report types to customize which
related objects are joined in the report.
SEE ALSO:
Find Object Management Settings
Object Relationships Overview
Considerations for Relationships
Define a Custom Object
Find Object Management Settings
Considerations for Relationships
Review the following considerations before creating relationships between objects:
Relationship Limits
Each custom object can have up to two master-detail relationships and many lookup
relationships. Each relationship is included in the maximum number of custom fields allowed.
Converting Relationships
You can convert a master-detail relationship to a lookup relationship as long as no roll-up
summary fields exist on the master object.
You can convert a lookup relationship to a master-detail relationship, but only if the lookup
field in all records contains a value.
Self Relationships
You can create a relationship from an object to itself, but it must be a lookup relationship, and
a single record can't be linked to itself. However, a record can indirectly relate to itself. For
example, the Holiday Promotion campaign can have the Direct Mail campaign selected in the
lookup relationship, and the Direct Mail campaign can have the Holiday Promotion campaign
selected in the lookup relationship.
You can't create a many-to-many self relationship, that is, the two master-detail relationships
on the junction object can't have the same master object.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Salesforce Connect external
objects are available in:
Developer Edition and for
an extra cost in: Enterprise,
Performance, and
Unlimited Editions
Icons for Custom Related Lists
The icon you select for the associated custom tab also displays in any custom related list you create based on a relationship.
Custom related lists do not include an icon if they are based on a relationship with a custom object that does not have a custom
tab.
Master-Detail Relationships
To create multilevel master-detail relationships, you need the “Customize Application” user permission.
When you define a master-detail relationship, the custom object on which you are working is the “detail” side. Its data can appear
as a custom related list on page layouts for the other object.
By default, records can’t be reparented in master-detail relationships. Administrators can, however, allow child records in master-detail
relationships on custom objects to be reparented to different parent records by selecting the Allow reparenting option in
the master-detail relationship definition.
You can have up to three custom detail levels.
Standard objects can't be on the detail side of a custom object in a master-detail relationship.
105
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
An object can appear once in multilevel master-detail relationships. For example, a subdetail object in one multilevel master-detail
relationship can't also be the owner of the master object in another multilevel master-detail relationship. A subdetail object can't
also be the master object of the subdetail object's detail object.
Multilevel master-detail relationships do not support division transfers.
You can't create a master-detail relationship if the custom object already contains data. You can, however, create the relationship
as a lookup and then convert it to master-detail if the lookup field in all records contains a value.
Converting relationships from lookup to master-detail, or from master-detail to lookup behaves the same as for two-object master-detail
relationships. That is, the two linked objects in the detail-subdetail1, or subdetail1-subdetail2 relationship have the same conversion
limits as the master-detail relationship.
Roll-up summary fields work as in two-object master-detail relationships. A master can roll up fields on detail records; however, it
can't directly roll up fields on subdetail records. To achieve this, the detail record must have a roll-up summary field for the field on
the subdetail record, allowing the master to roll up from the detail's roll-up summary field.
You can use multilevel master-detail relationships in custom report types. The Allow Reports checkbox must be checked
when you create the custom object. Custom report types created for multilevel master-detail relationships count towards the
organizations custom report type limit and no reports are generated if this limit is exceeded.
Custom junction objects can't have detail objects. That is, a custom junction object can't become the master object in a multilevel
master-detail relationship.
You can’t delete a custom object if it is on the master side of a master-detail relationship. If you delete a custom object that is on
the detail side of a master-detail relationship, the relationship is converted to a lookup relationship.
Deleting a detail record moves it to the Recycle Bin and leaves the master record intact; deleting a master record also deletes related
detail and subdetail records. Undeleting a detail record restores it, and undeleting a master record also undeletes related detail and
subdetail records. However, if you delete a detail record and later, separately, delete its master record, you cannot undelete the detail
record, as it no longer has a master record to relate to.
As a best practice, don't exceed 10,000 child records for a master-detail relationship.
Many-to-Many Relationships
Junction object records are deleted when either associated master record is deleted and placed in the Recycle Bin. If both associated
master records are deleted, the junction object record is deleted permanently and can't be restored.
Sharing access to a junction object record is determined by a user's sharing access to both associated master records and the
Sharing Setting option on the relationship field. See Custom Object Security on page 111. For example, if the sharing setting
on both parents is Read/Write, then the user must have Read/Write access to both parents in order to have Read/Write access to
the junction object. If, on the other hand, the sharing setting on both masters is Read-Only, a user with Read-Only rights on the
master records would have Read/Write access to the junction object.
In a many-to-many relationship, a user can't delete a parent record if there are more than 200 junction object records associated
with it and if the junction object has a roll-up summary field that rolls up to the other parent. To delete this object, manually delete
junction object records until the count is fewer than 200.
The first master-detail relationship you create on your junction object becomes the primary relationship. This affects the following
for the junction object records:
• Look and feel: The junction object's detail and edit pages use the color and any associated icon of the primary master object.
• Record ownership: The junction object records inherit the value of the Owner field from their associated primary master record.
Because objects on the detail side of a relationship do not have a visible Owner field, this is only relevant if you later delete
both master-detail relationships on your junction object.
• Division: If your organization uses divisions to segment data, the junction object records inherit their division from their associated
primary master record. Similar to the record ownership, this is only relevant if you later delete both master-detail relationships.
106
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
The second master-detail relationship you create on your junction object becomes the secondary relationship. If you delete the
primary master-detail relationship or convert it to a lookup relationship, the secondary master object becomes primary.
Roll-up summary fields that summarize data from the junction object can be created on both master objects.
Formula fields and validation rules on the junction object can reference fields on both master objects.
You can define Apex triggers on both master objects and the junction object.
A junction object can't be on the master side of another master-detail relationship.
You can't create a many-to-many self relationship, that is, the two master-detail relationships on the junction object can't have the
same master object.
Lookup Relationships
If the lookup field is optional, you can specify one of three behaviors to occur if the lookup record is deleted:
• Clear the value of this field This is the default. Clearing the field is a good choice when the field does not have
to contain a value from the associated lookup record.
• Don’t allow deletion of the lookup record that’s part of a lookup relationship This
option restricts the lookup record from being deleted if you have any dependencies, such as a workflow rule, built on the
relationship.
• Delete this record also Available only if a custom object contains the lookup relationship, not if it’s contained by
a standard object. However, the lookup object can be either standard or custom. Choose when the lookup field and its associated
record are tightly coupled and you want to completely delete related data.
Warning: Choosing Delete this record also can result in a cascade-delete. A cascade-delete bypasses security
and sharing settings, which means users can delete records when the target lookup record is deleted even if they don’t
have access to the records. To prevent records from being accidentally deleted, cascade-delete is disabled by default. Contact
Salesforce to get the cascade-delete option enabled for your organization.
Cascade-delete and its related options are not available for lookup relationships to business hours, community, lead, price
book, product, or user objects.
In a chain of lookup relationships, these behaviors work independently on each target field at each level. Say, for example, field A is
the target lookup of field B, which in turn is the target lookup of field C. You can have a delete restriction on A and none on B, which
means that A can’t be deleted but B can. Once B is deleted, the relationship between A and B no longer exists and C will hold an
empty value for the lookup.
In a multilevel lookup relationship, these options might conflict. For example, in the scenario where field A is the target lookup of
field B, which in turn is the target lookup of field C, you might specify that A can delete B, but B cannot be deleted because it’s in a
relationship with C. If you try to delete A, you’ll get an error saying that B can’t be deleted because it’s linked to C.
If the parent record in a lookup relationship is deleted, the field history tracking for the child record does not record the deletion.
For example, if a parent account is deleted, the Account History related list for the child account does not show the deletion.
Relationships on External Objects
Lookup, external lookup, and indirect lookup relationships have some special behaviors and limitations.
• Only lookup, external lookup, and indirect lookup relationships are available for external objects. No other relationship types are
supported.
• Depending on the availability of the external system, related lists of child external objects may load slowly when users view the
parent record detail pages.
• Relationships that involve external objects allow users to create child records from the record detail pages of parent records.
However, the relationship field on each new child record isn’t automatically populated to identify the parent record.
107
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
• Syncing doesn’t create relationship fields on the external objects in your Salesforce org. However, you can change the field type
of a sync-created custom field to Lookup Relationship, External Lookup Relationship, or Indirect Lookup Relationship. Changing
the field type of an existing custom field is simpler and more efficient than manually creating a relationship field on the external
object.
For example, suppose that the external system has a foreign key relationship. Syncing the related tables creates a text field in
your org for the external column that identifies the foreign keys. To reflect the foreign key relationship within your org, change
the field type of that text field to External Lookup Relationship.
• A relationship field is a type of custom field. Therefore, like all custom fields on an external object, relationship fields can be
overwritten when you sync the external object. See the sync considerations for each Salesforce Connect adapter that you use.
• Cascade-delete isn’t available for external object relationships.
• In Salesforce Classic, indirect lookup relationship fields don’t display the expected names of parent records. Instead, each indirect
lookup relationship field displays the value of the target field on the parent object. To find related records, target field values are
matched against the values of the indirect lookup relationship field on the child object. The target field, which has the External
ID and Unique attributes, is selected when an indirect lookup relationship field is created.
• In Salesforce Classic, external lookup relationship fields don’t always display the expected names of parent records.
– In a list view, an external lookup relationship field displays the parent object ID or the value of the parent object’s External
ID standard field. The latter appears by default, but if a custom field on the parent object has the Is Name Field
attribute, the parent object ID is displayed.
– In a record detail page, an external lookup relationship field displays the name as expected if the org has previously retrieved
the parent record. If you see an ID in an external lookup relationship field, reload the page to replace the ID with the name.
• Lookup search isn’t available for external lookup relationship fields. To edit an external lookup relationship field, manually enter
the value of the External ID standard field for the parent record. This limitation doesn’t apply when the parent external
object is associated with the cross-org adapter for Salesforce Connect.
• Lookup search isn’t available for indirect lookup relationship fields. To edit an indirect lookup relationship field, manually enter
the value of the target field of the parent record. The target field is the custom field with External ID and Unique
attributes that was selected when the indirect lookup relationship was created. To determine related records, Salesforce matches
target field values against the values of the indirect lookup relationship field on the child object.
• With external lookup and indirect lookup relationships, the parent record appears as a clickable link in the relationship field on
the child record. If the child record is viewed by a user who doesn’t have access to the parent record, the parent record appears
in the relationship field as plain text instead of a link.
• Lookup filters aren’t available for external lookup relationship fields.
• Indirect lookup relationship fields can be created on external objects only.
• Only objects that have a custom field with the External ID and Unique attributes are available as parent objects in
indirect lookup relationships. If you don't see the desired object when you create an indirect lookup relationship field, add a
custom unique, external ID field to that object.
• If the external system uses case-sensitive values in the specified External Column Name, make sure that the parent object field
is also case-sensitive. When you define the parent object’s custom field, select External ID, Unique, and Treat "ABC" and "abc"
as different values (case sensitive).
Impact of Relationships on Reports
The type of relationship you create affects which standard report types are available and how they are categorized. These report
types determine which related objects can be included in the report:
• Lookup relationships allow data from the two related objects to be joined in one report.
108
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
• Master-detail relationships allow data from three objects to be joined in one report: the master object, the detail object, plus
one other lookup object. If the detail object has multiple lookup relationships, a separate report type is available based on each
lookup.
• Many-to-many relationships provide two standard report types that join the master objects and the junction object. The report
types are:
– “Primary master with junction object and secondary master” in the primary master object's report category.
– “Secondary master with junction object and primary master” in the secondary master object's report category.
The order of the master objects in the report type is important. The master object listed first determines the scope of records
that can be displayed in the report.
The reporting impact of each relationship type is summarized in the following table:
Relationship Type
Standard Report Types
Report Type Category
Lookup
Object by itself
Based on the object
Object with first lookup
Object with second lookup
Object with third lookup
Master-Detail
Master object by itself
Master object
Master object with detail object
Master object with detail object and first
lookup
Master object with detail object and
second lookup
Master object with detail object and third
lookup
Many-to-Many
Primary master object by itself
Primary master object
Secondary master object by itself
and
Primary master object with junction object Secondary master object
and secondary master object
Secondary master object with junction
object and primary master object
Custom report types give you more flexibility to join data from multiple objects, including lookups as well as master-detail relationships.
Important: Converting a relationship from lookup to master-detail or vice versa can cause existing custom reports to become
unusable due to the different standard report types available for each type of relationship. We recommend that you test your
109
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
custom reports immediately after converting the relationship type. If you revert your relationship back to the original type, the
reports are restored and become usable again.
SEE ALSO:
Object Relationships Overview
Create a Many-to-Many Relationship
External Object Relationships
Create Record Types for Custom Objects
Create record types for a custom object to display different picklist values and page layouts to
different users based on their profiles.
EDITIONS
1. From the object management settings for a custom object, go to Record Types.
Available in: Salesforce
Classic
2. Click New in the Record Types related list.
3. Choose Master from the Existing Record Type drop-down list to copy all available
picklist values, or choose an existing record type to clone its picklist values.
Note: When you create a new record type without cloning an existing one, the new
record type automatically includes the master picklist values for both standard and custom
picklists. You can then customize the picklist values for the record type.
4. Enter a Record Type Label that's unique within the object.
5. Enter a description.
6. Select Active to activate the record type.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create record types for
custom objects:
• Customize Application
7. Select Enable for Profile next to a profile to make the record type available to users
with that profile. Select the checkbox in the header row to enable it for all profiles.
Tip: If each profile is associated with a single record type, users will never be prompted to select a record type when creating
new records.
8. For enabled profiles, select Make Default to make it the default record type for users of that profile. Select the checkbox in the
header row to make it the default for all profiles.
9. Click Next.
10. Choose a page layout option to determine what page layout displays for records with this record type:
• To apply a single page layout for all profiles, select Apply one layout to all profiles and choose the page
layout from the drop-down list.
• To apply different page layouts based on user profiles, select Apply a different layout for each profile
and choose a page layout for each profile.
11. Click Save to edit the values of the standard and custom picklists available for the record type, or click Save and New to create
another record type.
SEE ALSO:
Find Object Management Settings
110
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Customize Search Layouts for Custom Objects
You can customize which custom object fields display for users in search results, lookup dialogs,
and the key lists on custom tab home pages. You can specify a different set of fields to show in
each search layout. The settings apply to all users in your organization.
You can also customize which buttons display in custom list views and search results. You can hide
a standard list view button or display a custom button. Standard buttons aren’t available on search
result layouts. To display a custom button, create the custom button, giving it the List Button
Display Type.
1. From the object management settings for a custom object, go to Search Layouts.
2. Click Edit next to the search layout that you want to modify.
Note: The fields you select for the key lists on the custom tab home page are also used
as the columns displayed in the default All list view and as the default columns for any
new list views. To view different columns, customize the list view itself.
3. Move fields between Available Fields and Selected Fields.
• To customize which fields display in the layout, select one or more fields and click Add or
Remove.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
To define search layouts for
custom objects:
• Customize Application
• To sort fields in the layout, select one or more fields in Selected Fields and click Up or Down.
• To select multiple fields individually, use CTRL+click.
• To select multiple fields as a group, use SHIFT+click.
4. Click Save.
SEE ALSO:
Customize Search Layouts
Custom Object Security
Learn how security settings work together so you can control access to your custom objects with
great flexibility.
EDITIONS
Set custom object security at the following levels
Available in: both Salesforce
Classic and Lightning
Experience
• Tab—display the custom tab for the appropriate users based on their user profiles.
• Object—set the access users have to create, read, edit, and delete records for each object.
• Records—set the default sharing model for all your users. This determines the access users
have to custom object records that they do not own.
• Relationship—for objects on the detail side of a master-detail relationship, specify the sharing
access that users must have to the master record in order to create, edit, or delete the associated
detail records. This is specified in the Sharing Setting attribute of the master-detail
relationship field on the detail object.
• Fields—set the level of access users have to fields on your custom object page layout.
These requirements apply to custom objects with no master-detail relationship.
111
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Tabs are not available in
Database.com.
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Action
Required Privileges
Create a record
“Create” permission. The user must have the tab displayed to create
a new record from the Create New drop-down list in the sidebar.
View a record
“Read” permission and Public Read Only or Public Read/Write
sharing model if not the record owner.
Edit a record
“Edit” permission and Public Read/Write sharing model if not the
record owner.
Delete a record
“Delete” permission and must be the record owner or above the
record owner in the role hierarchy.
These requirements apply to custom objects that have a master-detail relationship with a standard or custom object.
Action
Required Privileges
Create a record
“Create” permission and either read or read/write access to the
related master record, depending on the value of the Sharing
Setting attribute of the master-detail relationship field on the
detail object.
View a record
“Read” permission and read access to the related master record. If
the record has two master records in a many-to-many relationship,
the user must have read access to both master records.
Edit a record
“Edit” permission and either read or read/write access to the related
master record, depending on the value of the Sharing
Setting attribute of the master-detail relationship field on the
detail object.
Delete a record
“Delete” permission and either read or read/write access to the
related master record, depending on the value of the Sharing
Setting attribute of the master-detail relationship field on the
detail object.
When a user deletes a record that has related custom object
records, all related custom object records are deleted regardless
of whether the user has delete permission to the custom object.
Delegated administrators can manage nearly every aspect of specified custom objects, but they cannot create or modify relationships
on the object or set organization-wide sharing defaults.
112
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Notes on Enabling Activities for Custom Objects
• If you enable activities when creating a custom object, the activity related lists are added to the
default page layout automatically. If you enable activities later, after the custom object already
exists, you must add the related lists to the page layout manually.
• Disabling activities for a custom object does not delete existing activity records. However,
activity related lists are removed from custom object pages, and reports containing activities
and the custom object are deleted.
• If a custom object has a master-detail relationship with accounts, the custom object’s activities
roll up to the account and cause the account’s Last Activity date to be updated. For
custom objects related to other types of records, the activities do not roll up.
• The ability to send emails or create mail merge documents is available for activities on custom
objects. The email must be sent to a contact or lead.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
• When you change the ownership of a custom object record, any open activities related to that
custom object are also transferred to the new record owner.
• You cannot disable activity tracking for a custom object if any workflow tasks are associated with that custom object, or if tasks and
events are child data sets of the custom object in a mobile configuration.
• Custom object records can only be associated with a call log in Salesforce CRM Call Center if activities are enabled for the object.
SEE ALSO:
Define a Custom Object
113
Extend Salesforce with Clicks, Not Code
Store Information That’s Unique to Your Organization
Using Custom Related Lists
Important: If you landed on this page because you were looking for more information about
a particular object, your Salesforce administrator didn’t create a help page for that object. The
Salesforce Help covers only the standard objects provided with the initial Salesforce integration.
Custom related lists display on the lower portion of the detail page for another record. They list the
custom object records that are associated with that record.
EDITIONS
Available in: Salesforce
Classic
• Click Edit or Del to edit or delete the custom object record.
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
• Click New to create a new custom object record that is associated with the record you are
viewing.
USER PERMISSIONS
From a custom related list, you can:
• Click the custom object record name to view detailed information.
To view custom object
record related lists:
• Read on the custom
object
AND
Read on the associated
record
To change custom object
records:
• Edit on the custom object
To create custom object
records:
• Create on the custom
object
To delete custom object
records:
• Delete on the custom
object
114
Extend Salesforce with Clicks, Not Code
Design Your Own Data Model
Viewing Custom Object Lists
Important: If you landed on this page because you were looking for more information about
a particular object, your Salesforce administrator didn’t create a help page for that object. The
Salesforce Help covers only the standard objects provided with the initial Salesforce integration.
The custom objects list page displays a list of custom object records in your current view. A list view
includes custom object records of one type only. You can’t view more than one type of custom
object in a single list view.
• Click a custom object name to view the custom object record detail. Click Edit or Del next to
a custom object record name to edit or delete the record.
• To take ownership of custom object records in a queue, view the queue list view, check the
box next to one or more records, and then click Accept.
Note: You can view and accept records only from queues you belong to, or if you are
higher in the role hierarchy than a queue member. Administrators, users with the “Modify
All” object-level permission for the given object, and users with the “Modify All Data”
permission, can view and take records from any queue.
• To transfer ownership of multiple records at once, select the box next to one or more custom
object records and click Change Owner. Enter the new record owner, optionally select Send
Notification Email to send an email to the new record owner, and click Save.
EDITIONS
Available in: Salesforce
Classic
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
To view custom object lists:
• Read on the custom
object
To create custom object
records:
• Create on the custom
object
• Click New Custom Object Name or select the custom object name from the Create New
drop-down list in the sidebar to create a custom object of that type.
Design Your Own Data Model
Schema Builder provides a dynamic environment for viewing and modifying all the objects and
relationships in your app. This greatly simplifies the task of designing, implementing, and modifying
your data model, or schema. Schema Builder is enabled by default.
You can view your existing schema and interactively add new custom objects, custom fields, and
relationships, simply by dragging and dropping. Schema Builder automatically implements the
changes and saves the layout of your schema any time you move an object. This eliminates the
need to click from page to page to find the details of a relationship or to add a new custom field
to an object in your schema.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
Schema Builder provides details like the field values, required fields, and how objects are related by displaying lookup and master-detail
relationships. You can view the fields and relationships for both standard and custom objects.
Schema Builder lets you add the following to your schema:
• Custom objects
• Lookup relationships
• Master-detail relationships
• All custom fields except: Geolocation
Note: You can’t export your schema from Schema Builder (for example, to use the schema in another org).
How Do I Access Schema Builder?
115
Extend Salesforce with Clicks, Not Code
Design Your Own Data Model
Schema Builder Custom Object Definition
SEE ALSO:
How Do I Access Schema Builder?
Custom Field Types
Change Sets
How Do I Access Schema Builder?
From Setup, enter Schema Builder in the Quick Find box, then select Schema Builder.
EDITIONS
When working with Schema Builder:
• Click an object and move it to any space on the canvas. Schema Builder saves the layout of your
schema any time you move an object.
• Click Auto-Layout to sort the layout of the objects in your schema.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
Important: When you click Auto-Layout, you can’t undo it.
USER PERMISSIONS
• Click View Options to:
– Display Element Names if you prefer system names, or Display Element Labels if you
prefer text values.
– Show/Hide Relationships
To view objects in Schema
Builder:
• Customize Application
– Show/Hide Legend
• The Elements tab lets you drag and drop new custom objects and fields onto the canvas.
– To create a custom object, see Creating Objects with Schema Builder.
– To create a custom field, see Creating Fields with Schema Builder.
• The Objects tab lets you select objects to display on the canvas.
– Click the drop-down list in the sidebar to filter your list of objects:
• All Objects
• Selected Objects
• Standard Objects
• Custom Objects
• System Objects
Note: Objects created outside of Schema Builder, such as through an app or the API, don’t automatically display on
the canvas. Select the checkbox for the object created outside Schema Builder to display it on the canvas.
– To search for an object, type its name in the Quick Find box.
– Hover over an object in your list of objects and click
to find it on the canvas.
• Hover over relationship lines to show relationship details such as lookup and master-detail relationships. Click the name of the object
to find it on the canvas. You can hide relationships if your schema is taking too long to load.
• To view the details of a field in a new window, right-click the element name or label and select View Field in New Window.
• To edit properties of a custom field, right-click the element name or label and select Edit Field Properties.
116
Extend Salesforce with Clicks, Not Code
Design Your Own Data Model
• To manage permissions of a custom field, click the element name or label and select Manage Field Permissions. Use the dialog
box that appears to manage the field’s visibility and writeability for all standard and custom profiles. By default, the field-level security
for custom fields is set to visible and editable for internal profiles—those not cloned from Partner User or Customer Portal Manager.
Fields that are not normally editable, such as formulas and roll-up summary fields, are visible and read only.
• Click
to:
– Hide Object on Canvas
– View Object detail in a new window
– View Page Layouts detail in a new window
• For objects with many fields (Lead or Campaign, for example), click Show More Fields to display all the fields.
•
To zoom in, click
. To zoom out, click
.
Note: You can’t save the level of zoom when closing Schema Builder.
•
To collapse the sidebar, click . To expand it, click .
• The map in the lower right corner shows the overall layout of your objects on the canvas. Click the map to navigate the layout of
your objects. To pan across the schema layout while zoomed in, click and hold the canvas while moving the mouse.
• To close the Schema Builder and save the layout of your objects, click Close.
Important: If your schema contains many objects and fields, loading can take a long time. Click Hide Relationships to improve
Schema Builder performance.
Create Objects with Schema Builder
Create Fields with Schema Builder
Delete Custom Objects with Schema Builder
You can delete the custom objects that you no longer need by using Schema Builder.
Delete Custom Fields with Schema Builder
Conveniently avoid “custom field clutter” by using Schema Builder to delete custom fields that you no longer need.
SEE ALSO:
Create Objects with Schema Builder
Delete Custom Objects with Schema Builder
Create Fields with Schema Builder
Delete Custom Fields with Schema Builder
Find Object Management Settings
117
Extend Salesforce with Clicks, Not Code
Design Your Own Data Model
Create Objects with Schema Builder
To create a custom object with Schema Builder:
EDITIONS
1. Click the Elements tab.
2. Click Object and drag it onto the canvas.
3. Enter information to define your object. For a list of object definitions, see Schema Builder
Custom Object Definition on page 119.
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
4. Click Save.
USER PERMISSIONS
SEE ALSO:
To create new custom
objects in Schema Builder:
• Customize Application
Schema Builder Custom Object Definition
Create Fields with Schema Builder
To create a custom field with Schema Builder:
EDITIONS
1. Click the Elements tab.
Available in: both Salesforce
Classic and Lightning
Experience
2. Click a field and drag it onto an object on the canvas.
3. Enter a Field Label.
Salesforce populates Field Name using the field label. This name can contain only
underscores and alphanumeric characters, and must be unique in your org. It must begin with
a letter, not include spaces, not end with an underscore, and not contain two consecutive
underscores.
Available in all editions
Ensure that the custom field name and label are unique for that object.
To create new fields in
Schema Builder:
• Customize Application
• If a standard and custom field have identical names or labels, the merge field displays the
custom field value.
USER PERMISSIONS
• If two custom fields have identical names or labels, the merge field may display an
unexpected value.
If you create a field label called Email and a standard field labeled Email already exists, the merge field may be unable to
distinguish between the fields. Adding a character to the custom field name makes it unique. For example, Email2.
4. Enter a Description of the custom field.
5. Enter Help Text to detail the purpose and function of a custom field.
6. Enter a Default Value to automatically insert a value of a custom field when a new record is created.
7. Depending on the custom field type you choose, enter any remaining field attributes.
8. Click Save.
Any field you add through Schema Builder isn’t automatically added to the page layout. You will need to edit the page layout to specify
where the field should be displayed.
118
Extend Salesforce with Clicks, Not Code
Design Your Own Data Model
Delete Custom Objects with Schema Builder
You can delete the custom objects that you no longer need by using Schema Builder.
Schema Builder displays a list of side effects when you try to delete a custom object. Be sure you’re
ready to accept these side effects before finalizing the deletion. See Delete Custom Objects on page
93 and Manage Deleted Custom Objects on page 95.
1. Click
on the custom object’s icon.
2. Select Delete Object.... A dialog box displays that explains the side effects of deleting an object.
Read this information carefully.
3. If you accept the conditions, check Yes, I want to delete the custom object.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To delete custom objects in
Schema Builder:
• Customize Application
4. Click Delete.
Delete Custom Fields with Schema Builder
Conveniently avoid “custom field clutter” by using Schema Builder to delete custom fields that you
no longer need.
EDITIONS
Schema Builder displays a list of side effects when you try to delete a custom field. Be sure you’re
ready to accept these side effects before finalizing the deletion.
Available in: both Salesforce
Classic and Lightning
Experience
1. Right-click on the custom field.
2. Select Delete Field.... A dialog box displays that explains the side effects of deleting a custom
field. Read this information carefully.
3. If you accept the conditions, check Yes, I want to delete the custom field.
Available in all editions
USER PERMISSIONS
To delete custom fields in
Schema Builder:
• Customize Application
4. Click Delete.
Schema Builder Custom Object Definition
Field
Description
EDITIONS
Label
A name used to refer to the object in any user
interface pages.
Plural Label
The plural name of the object. If you create a
tab for this object, this name is used for the tab.
Available in: both Salesforce
Classic and Lightning
Experience
Starts with a vowel sound
If it’s appropriate for your organization’s default
language, check if your label should be
preceded by "an" instead of "a".
Object Name
A unique name used to refer to the object when
using the API. In managed packages, this unique
name prevents naming conflicts on package
installations. The Object Name field can contain
only underscores and alphanumeric characters.
119
Available in all editions
Extend Salesforce with Clicks, Not Code
Field
Design Your Own Data Model
Description
It must be unique, begin with a letter, not include spaces, not end
with an underscore, and not contain two consecutive underscores.
Description
An optional description of the object. A meaningful description
helps you remember the differences between your custom objects
when you’re viewing them in a list.
Record Name
The name used in page layouts, list views, related lists, and search
results.
Data Type
The type of field (text or auto-number) for the record name. Records
that have unique IDs instead of names use auto-numbers. An
auto-number is a unique number assigned automatically. It is
always a read-only field.
Allow Reports
Makes the data in the custom object records available for reporting
purposes.
To create reports on custom objects, choose the Other Reports
report type category, unless the custom object has a relationship
with a standard object. When the custom object has a master-detail
relationship with a standard object or is a lookup object on a
standard object, select the standard object for the report type
category instead.
Allow Activities
Allows users to associate tasks and scheduled calendar events
related to the custom object records.
Track Field History
Enables your organization to track changes to fields on the custom
object records, such as who changed the value of a field, when it
was changed, and what the value of the field was before and after
the edit. History data is available for reporting, so users can easily
create audit trail reports when this feature is enabled.
Enable Divisions
If your organization has divisions enabled, select this option to
enable the custom object for divisions. Divisions group records for
simplified search results, list views, reports, and other areas within
Salesforce. Salesforce adds a Division field to the custom
object. If the custom object is the master in a master-detail
relationship, custom objects on the detail side also get the
Division field and inherit their division from the master record.
Available for Customer Portal
This option makes the custom object available through the
Salesforce Customer Portal.
Namespace Prefix
In a packaging context, a namespace prefix is a one to 15-character
alphanumeric identifier that distinguishes your package and its
contents from packages of other developers on AppExchange.
Namespace prefixes are case-insensitive. For example, ABC and
abc are not recognized as unique. Your namespace prefix must be
120
Extend Salesforce with Clicks, Not Code
Create Custom Data Sets
Field
Description
globally unique across all Salesforce organizations. It keeps your
managed package under your control exclusively.
Deployment Status
Indicates whether the custom object is visible to other users.
Add Notes & Attachments...
Allows users to attach notes and attachments to custom object
records. This allows you to attach external documents to any object
record, in much the same way that you can add a PDF or photo as
an attachment to an email.
This option is only available when you are creating a new object.
Create Custom Data Sets
Use custom settings to create custom sets of data, or to create and associate custom data for an
org, profile, or user.
EDITIONS
Custom settings are similar to custom objects in that they let you customize org data. Unlike custom
objects which have records based on them, custom settings let you utilize custom data sets across
your org, or distinguish particular users or profiles based on custom criteria.
Available in: both Salesforce
Classic and Lightning
Experience
Custom settings data is exposed in the application cache, which enables efficient access without
the cost of repeated queries to the database. This data can then be used by formula fields, validation
rules, flows, Apex, and the SOAP API
Available in: Group,
Professional, Developer,
Enterprise, Performance,
Unlimited, and
Database.com Editions.
Note: If you're thinking of using List Custom Settings, consider using Custom Metadata
Types instead. Unlike with List Custom Settings, you can migrate the records of Custom
Metadata Types using Packages or Metadata API tools.
Packages are not available
in Database.com.
There are two types of custom settings:
List Custom Settings
A type of custom setting that provides a reusable set of static data that can be accessed across
your organization. If you use a particular set of data frequently within your application, putting
that data in a list custom setting streamlines access to it. Data in list settings does not vary with
profile or user, but is available organization-wide. Examples of list data include two-letter state
abbreviations, international dialing prefixes, and catalog numbers for products. Because the
data is cached, access is low-cost and efficient: you don't have to use SOQL queries that count
against your governor limits.
USER PERMISSIONS
To manage, create, edit,
and delete custom settings:
• Customize Application
Hierarchy Custom Settings
A type of custom setting that uses a built-in hierarchical logic that lets you “personalize” settings for specific profiles or users. The
hierarchy logic checks the organization, profile, and user settings for the current user and returns the most specific, or “lowest,” value.
In the hierarchy, settings for an organization are overridden by profile settings, which, in turn, are overridden by user settings.
The following examples illustrate how you can use custom settings:
• A shipping application requires users to fill in the country codes for international deliveries. By creating a list setting of all country
codes, users have quick access to this data without needing to query the database.
• An application calculates and tracks compensation for its sales reps, but commission percentages are based on seniority. By creating
a hierarchy setting, the administrator can associate a different commission percentage for each profile in the sales organization.
121
Extend Salesforce with Clicks, Not Code
Create Custom Data Sets
Within the application, one formula field can then be used to correctly calculate compensation for all users; the personalized setting
at the profile level inserts the correct commission percentage.
• An application displays a map of account locations, the best route to take, and traffic conditions. This information is useful for sales
reps, but account executives only want to see account locations. By creating a hierarchy setting with custom checkbox fields for
route and traffic, you can enable this data for just the “Sales Rep” profile.
To create and use custom settings:
1. Create the custom setting.
2. Add fields to the custom setting.
3. Add data and set the access level for the custom setting data.
4. Reference the custom setting data in your application, using formula fields, validation rules, Apex, or the SOAP API.
You can also include a custom setting in a package. The visibility of the custom setting in the package depends on the Visibility
setting.
Note: Only custom settings definitions are included in packages, not data. If you need to include data, you must populate the
custom settings using a standard Apex or API script run by the subscribing organization after they have installed the package.
Access Custom Settings
You can access custom settings from formula fields, validation rules, Apex, and the SOAP API.
Define Custom Settings
View Custom Settings
Add Custom Settings Fields
After you define custom settings, add fields to them. The custom fields contain the data used by the custom setting.
Manage Custom Settings Data
Custom Settings Limits and Considerations
When working with custom settings, be aware of the following considerations and limits on the amount of cached data.
122
Extend Salesforce with Clicks, Not Code
Create Custom Data Sets
Access Custom Settings
You can access custom settings from formula fields, validation rules, Apex, and the SOAP API.
EDITIONS
Here are some sample code segments.
Formula Fields
Formula fields only work for hierarchy custom settings; they can’t be used for list custom settings.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Group,
Professional, Developer,
Enterprise, Performance,
Unlimited, and
Database.com Editions.
Packages are not available
in Database.com.
USER PERMISSIONS
To manage, create, edit,
and delete custom settings:
• Customize Application
{!$Setup.CustomSettingName__c.CustomFieldName__c}
Apex
Apex can access both custom setting types.
Note: If Privacy for a custom setting is Protected and the custom setting is contained in a managed package, the
subscribing organization cannot edit the values or access them using Apex.
Samples for List Custom Settings
When you add data to a custom setting, you must name each set of data. Then you can distinguish between the sets of data by
the data set name. The following returns a map of custom settings data. The getAll method returns values for all custom
fields associated with the list setting.
Map<String_dataset_name, CustomSettingName__c> mcs = CustomSettingName__c.getAll();
The following example uses the getValues method to return all the field values associated with the specified data set. This
method can be used with both list and hierarchy custom settings, using different parameters.
CustomSettingName__c mc = CustomSettingName__c.getValues(data_set_name);
Samples for Hierarchy Custom Settings
The following example uses the getOrgDefaults method to return the data set values for the organization level:
CustomSettingName__c mc = CustomSettingName__c.getOrgDefaults();
The following example uses the getInstance method to return the data set values for the specified profile. The
getInstance method can also be used with a user ID.
CustomSettingName__c mc = CustomSettingName__c.getInstance(Profile_ID);
123
Extend Salesforce with Clicks, Not Code
Create Custom Data Sets
SOAP API
Custom settings that have Privacy defined as Public are exposed to the API in the same way custom objects are exposed.
Note: If Privacy is defined as Protected, and the custom setting is contained in a managed package, the custom setting
is not accessible using the API in either the developer organization or a subscribing organization.
Use any tool with API access to perform query or profile-permission-setting operations.
Note: You can also access custom settings data through a Standard Object Query Language (SOQL) query, but this method
doesn't use the application cache. It’s similar to querying a custom object.
SEE ALSO:
Create Custom Data Sets
Define Custom Settings
To create or edit a custom setting:
EDITIONS
1. From Setup, enter Custom Settings in the Quick Find box, then select Custom
Settings.
2. Click New to create a new custom setting, click Edit next to the name of a custom setting, or
click Edit while viewing the details of a custom setting.
Note: A
icon indicates that the custom setting is in an installed managed package.
You can’t edit or delete a custom setting installed from a managed package.
3. Define the following:
• Label—Enter the label displayed in the application.
• Object Name—Enter the name to be used when the custom setting is referenced by
formula fields, validation rules, Apex, or the SOAP API.
Note: Salesforce recommends using ASCII for the Object Name. The name can't
exceed 38 ASCII characters. If you use double byte, there are additional limits on the
number of characters allowed.
• Setting Type—Select a type of List or Hierarchy. The List type defines application-level
data, such as country codes or state abbreviations. The Hierarchy type defines personalization
settings, such as default field values, that can be overridden at lower levels in the hierarchy.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Group,
Professional, Developer,
Enterprise, Performance,
Unlimited, and
Database.com Editions.
Packages are not available
in Database.com.
USER PERMISSIONS
To manage, create, edit,
and delete custom settings:
• Customize Application
Important: After you save a custom setting, you cannot change this value.
• Visibility—Select a visibility of Protected or Public.
– Protected—If the custom setting is contained in a managed package, subscribing organizations can't see the custom setting:
it doesn't display as part of the package list. In addition, subscribing organizations can't access the custom setting using
either Apex or the API, however, developer organizations can. If the custom setting is contained in an unmanaged package,
the custom setting is available through the Enterprise WSDL like any custom object (as if the Visibility was Public.)
– Public—The custom setting is available through the Enterprise WSDL like any custom object. You can package custom
settings defined as public. The subscribing organizations can edit the values, as well as access them using Apex and the API,
regardless of the type of package (either managed or unmanaged).
Important: After you save a custom setting, you cannot change this value.
124
Extend Salesforce with Clicks, Not Code
Create Custom Data Sets
4. Enter an optional description of the custom setting. A meaningful description will help you remember the differences between your
custom settings when you’re viewing them in a list.
5. Click Save.
Note: Only custom settings definitions are included in packages, not data. If you need to include data, you must populate
the custom settings using a standard Apex or API script run by the subscribing organization after they have installed the
package.
After you create a custom setting, you must also add fields to the custom setting.
SEE ALSO:
Add Custom Settings Fields
Add Custom Settings Data
View Custom Settings
After you create a custom setting, you can view the details of the custom setting, manage the
custom setting, and add fields.
EDITIONS
From Setup, enter Custom Settings in the Quick Find box, then select Custom Settings,
then click the name of the custom setting you'd like to view. While viewing a custom setting, you
can:
Available in: both Salesforce
Classic and Lightning
Experience
• Click Edit to make changes to a custom setting.
Available in: Group,
Professional, Developer,
Enterprise, Performance,
Unlimited, and
Database.com Editions.
• Click Delete to delete a custom setting.
Note: A
icon indicates that the custom setting is in an installed managed package.
You can’t edit or delete a custom setting installed from a managed package.
Packages are not available
in Database.com.
• Click Manage to add data to a custom setting.
In addition, click New to add fields to the custom setting.
USER PERMISSIONS
SEE ALSO:
Define Custom Settings
To manage, create, edit,
and delete custom settings:
• Customize Application
125
Extend Salesforce with Clicks, Not Code
Create Custom Data Sets
Add Custom Settings Fields
After you define custom settings, add fields to them. The custom fields contain the data used by
the custom setting.
EDITIONS
1. From Setup, enter Custom Settings in the Quick Find box, then select Custom
Settings.
Available in: both Salesforce
Classic and Lightning
Experience
2. Click the custom setting that you want to add fields to. (If you just created the custom setting,
the Custom Setting Detail page appears.)
3. Click New.
4. Select a field type and click Next.
Note: Record size is based on the maximum field size of each field type, not the actual
storage that’s used in each field. When adding fields to a custom setting definition, use
the appropriate type and specify a length that doesn’t exceed what’s needed for your
data. This action helps you avoid reaching the cached data limit. For example, if you create
a US social security number (SSN) field, select the Text data type and specify a length
of 9. If instead you selected a Text Area data type, the field would add 255 characters
to the usage count for each record, regardless of the number of characters entered.
5. Enter the details for the field.
Available in: Group,
Professional, Developer,
Enterprise, Performance,
Unlimited, and
Database.com Editions.
Packages are not available
in Database.com.
USER PERMISSIONS
To manage, create, edit,
and delete custom settings:
• Customize Application
6. Confirm the information, and then click Save or Save & New.
After you add fields, you need to add data, and for hierarchy custom settings, specify the access
level.
SEE ALSO:
Add Custom Settings Data
Manage Custom Settings Data
After defining custom settings and adding fields, populate the fields:
1. From Setup, enter Custom Settings in the Quick Find box, then select Custom
Settings.
2. Click Manage next to a custom setting, or from the detail page for a custom setting.
3. Provide or change values for the custom setting.
• If you are managing a list setting:
– Click New to add data to the fields.
– Click Edit next to the name of an existing set of data to change the name of the data
set or to change the data.
– Click Del next to the name of an existing set of data to delete the data set.
• If you are managing a hierarchy setting, decide where in the permission hierarchy you want
to add default data (organization, profile, or user).
To add default data at the organization level, click New in the Default Organization Level
Value section. If data has already been defined for the organization, you can only edit or
delete it.
126
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Group,
Professional, Developer,
Enterprise, Performance,
Unlimited, and
Database.com Editions.
USER PERMISSIONS
To manage, create, edit,
and delete custom settings:
• Customize Application
Extend Salesforce with Clicks, Not Code
Create Custom Data Sets
To add default data at the profile or user level, click New in the lower section of the page, near the Setup Owner.
After you have defined data, you can:
• Click Edit in the Default Organization Level Value section to change the default data set at the organization level, or Delete to
delete it (this is only for hierarchical custom settings.)
• Click View next to the name of an existing set of data to view the data (this is only for hierarchical custom settings.)
• Click Edit next to the name of an existing set of data to change the name of the data set or to change the data.
• Click Del next to the name of an existing set of data to delete the data set.
Add Custom Settings Data
View Custom Settings Usage and Data
SEE ALSO:
Custom Settings Limits and Considerations
Add Custom Settings Data
After you define your custom settings and add fields, you need to populate the fields with data.
You can define one or more data sets. For list custom settings, each data set is named and can be
accessed by that name using Apex, formula fields, and so on.
For custom settings that are hierarchies, the data is accessed based on the access level (user, profile,
or organization). The lowest level is used first, which means if you defined a data set at the user
level, unless otherwise specified in your application, that data is used. For example, you might want
to specify different contact numbers for your application: one for the general user, and one that is
only displayed for system administrators.
To add data to custom setting fields:
1. From Setup, enter Custom Settings in the Quick Find box, then select Custom
Settings, then click Manage next to a custom setting. Or from the detail page for a custom
setting, click Manage.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Group,
Professional, Developer,
Enterprise, Performance,
Unlimited, and
Database.com Editions.
USER PERMISSIONS
To manage, create, edit,
and delete custom settings:
• Customize Application
2. Click New or Edit next to an existing data set.
3. Add or change data.
For custom settings that are lists:
a. Specify or change the name for the data set. This name is used by Apex, formula fields, and
so on.
b. Enter or change data for all fields.
c. Click Save.
For custom settings that are hierarchies:
a. For the default organization level values, enter or change the data for the fields. The default organization location is automatically
populated.
b. For profile or user level values, select either Profile or User from the Location picklist. Enter the name of the profile
or user, or use the lookup dialog search. Then enter or change the data for the fields.
c. Click Save.
127
Extend Salesforce with Clicks, Not Code
Create Custom Data Sets
Note: For a hierarchy custom setting, you can add only one record for a profile or user. Adding two records for the same
profile or user results in an error.
SEE ALSO:
Manage Custom Settings Data
Add Custom Settings Fields
View Custom Settings Usage and Data
1. From Setup, enter Custom Settings in the Quick Find box, then select Custom
Settings.
EDITIONS
2. To view the percentage of custom settings data your org has used, click Get Usage. Once the
usage information is returned, the button no longer appears on the page.
Available in: both Salesforce
Classic and Lightning
Experience
3. To manage a custom setting, click Manage next to a previously defined custom setting, and
click View next to the data set you want to view. (This is only for hierarchical custom settings.)
SEE ALSO:
Add Custom Settings Fields
Available in: Essentials,
Group, Professional,
Developer, Enterprise,
Performance, Unlimited,
and Database.com Editions.
Add Custom Settings Data
USER PERMISSIONS
To manage, create, edit,
and delete custom settings:
• Customize Application
Custom Settings Limits and Considerations
When working with custom settings, be aware of the following considerations and limits on the
amount of cached data.
EDITIONS
• The total amount of cached data allowed for your org is the lesser of these two values:
Available in: both Salesforce
Classic and Lightning
Experience
– 10 MB
– 1 MB multiplied by the number of full-featured user licenses in your org
For example, if your org has three full licenses, you have 3 MB of custom setting storage. If your
org has 20 full licenses, you have 10 MB of storage.
Each certified managed package gets a separate limit in addition to your org limit. For example,
let’s say your org has two certified managed packages installed and your organization has three
full licenses. Each certified managed package can have 3 MB of custom setting storage in
addition to your org’s 3-MB custom setting storage limit.
• You can add up to 300 fields per custom setting, unless your field limit for custom objects is
lower than 300. If your custom objects field limit is lower than 300, your field limit for custom
settings is equal to your custom objects field limit.
• You can’t share a custom setting object or record.
• No owner is assigned when a custom setting is created, so the owner can’t be changed.
128
Available in: Group,
Professional, Developer,
Enterprise, Performance,
Unlimited, and
Database.com Editions.
USER PERMISSIONS
To manage, create, edit,
and delete custom settings:
• Customize Application
Extend Salesforce with Clicks, Not Code
Customize Fields
• Custom settings are a type of custom object. Each custom setting counts against the total number of custom objects available for
your organization.
• Accessing an undeleted custom setting in a formula field results in an error if the user doesn’t have the “Customize Application”
permission. To prevent this error, redeploy this custom setting to the organization. Alternatively, delete this custom setting, re-create
it with the same name and data, and then delete and re-create all formula fields that use this setting.
• If a cross-object formula references a currency field from a custom setting, this field value isn’t converted to the currency of the
record containing the formula. The result of the formula could be inaccurate if the custom setting field’s currency and the record’s
currency are different.
To see how much custom settings data your organization is using, from Setup, enter Custom Settings in the Quick Find
box, then select Custom Settings. For each custom setting, this page lists the size of one record, the number of records created, and
the total size used for each custom setting.
Record size is based on the maximum field size of each field type, not the actual storage that’s used in each field. When adding fields to
a custom setting definition, use the appropriate type and specify a length that doesn’t exceed what’s needed for your data. This action
helps you avoid reaching the cached data limit. For example, if you create a US social security number (SSN) field, select the Text data
type and specify a length of 9. If instead you selected a Text Area data type, the field would add 255 characters to the usage count
for each record, regardless of the number of characters entered.
SEE ALSO:
Create Custom Data Sets
Customize Fields
Customize standard and custom fields to tailor your org to your own unique requirements.
EDITIONS
You can:
Available in: both Salesforce
Classic and Lightning
Experience
• Modify some aspects of standard fields
• Change or add values to standard and custom picklist fields
• Define dependency rules between fields
Available in: All Editions
• Create custom fields to capture additional information
• Create formula fields that automatically calculate values based on the contents of other fields
• Define default values for custom fields
Standard Fields and Page
Layouts are not available in
Database.com
• Define validation rules for your fields
• Make a field required
USER PERMISSIONS
• Set fields to track changes, including the date, time, nature of the change, and who made the
change
• Create page layouts to control the display of fields
• Set field-level security to control access to fields
To create or change custom
fields:
• Customize Application
• Create or modify field sets
Customize Standard Fields
You can customize several aspects of standard fields, such as the values in picklists, the format for auto-number fields, tracking field
history, lookup filters on relationship fields, and field-level help.
Modify Standard Auto-Number Fields
Custom Fields
129
Extend Salesforce with Clicks, Not Code
Customize Fields
Create Custom Fields
Capture your unique business data by storing it in custom fields. When you create a custom field, you configure where you want it
to appear and optionally control security at the field level.
Define Default Field Values
Define a default value for a field. Use a formula to generate dynamic values, or constants for static values.
Validation Rules
Examples of Validation Rules
Review examples of validation rules for various types of apps that you can use and modify for your own purposes. Validation rules
verify that the data a user enters in a record meets the standards you specify before the user can save the record.
Require Field Input to Ensure Data Quality
Improve the quality of data that users enter in Salesforce by creating universally required fields.
About Field Sets
Roll-Up Summary Field
A roll-up summary field calculates values from related records, such as those in a related list. You can create a roll-up summary field
to display a value in a master record based on the values of fields in a detail record. The detail record must be related to the master
through a master-detail relationship. For example, you want to display the sum of invoice amounts for all related invoice custom
object records in an account’s Invoices related list. You can display this total in a custom account field called Total Invoice Amount.
Lookup Filters
Improve user productivity and data quality with lookup filters. Lookup filters are administrator settings that restrict the valid values
and lookup dialog results for lookup, master-detail, and hierarchical relationship fields.
Customize Standard Fields
You can customize several aspects of standard fields, such as the values in picklists, the format for
auto-number fields, tracking field history, lookup filters on relationship fields, and field-level help.
Tip: You can’t delete standard fields, but you can remove them from your page layouts.
1. Navigate to the fields page for your object.
2. Click the field label.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
3. To add custom help text, click Edit.
Available in: All Editions
except for Database.com.
4. On the field’s information page, you can—depending on your Edition—set field-level security,
view accessibility settings, and configure validation rules.
USER PERMISSIONS
You can also do more, depending on the field’s type. For example, if the field is a picklist, you
can add, delete, and reorder its values, and set dependencies. You can’t increase the field length
of a standard field. If you need a longer text area, consider creating a custom field.
Beyond the Basics
What does that Indexed checkbox mean on a field, and how did it get there?
130
To change standard fields:
• Customize Application
Extend Salesforce with Clicks, Not Code
Customize Fields
If a field is indexed, you can use sidebar search or advanced search to find values in the field. Having a field indexed can also
speed up other operations on the field, such as reporting. Check out this blog post to find out more: Know Thy Salesforce Field
Indexes for Fast Reports, List Views, and SOQL.
SEE ALSO:
Custom Fields
Add or Edit Picklist Values
Rename Object, Tab, and Field Labels
Getting Started with Field-Level Help
Lookup Filters
Modify Standard Auto-Number Fields
The unique identifiers for solutions, cases, and contracts are standard auto-number fields. Each
record is assigned a unique number with a specified format upon creation. You can modify the
format and numbering for these auto-number fields.
1. From the management settings for the object whose field you want to modify, go to the fields
area.
2. Click Edit next to the name of the field.
3. Enter a Display Format to control such formatting details as the minimum number of
leading zeros as well as any prefix or suffix for the number. See Custom Field Attributes on page
145.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Format changes do not affect existing records; they are applied only to new records.
4. Enter the number to be assigned to the next record that is created after you save your changes.
USER PERMISSIONS
5. Click Save.
To modify standard
auto-number fields:
• Customize Application
Warning: Salesforce warns you if the next number you enter is not higher than existing
numbers. However, it may be possible to create duplicate numbers if you change the
auto-number format multiple times using similar formats each time.
SEE ALSO:
Custom Field Types
131
Extend Salesforce with Clicks, Not Code
Customize Fields
Custom Fields
To tailor your organization, you can add custom fields for each of the tabs and objects that your
organization uses.
EDITIONS
For the total number of custom fields you can create, see Salesforce Limits.
Available in: both Salesforce
Classic and Lightning
Experience
Note: When your org is close to the limit of 800 custom fields and you delete or create fields,
field creation can fail. The physical delete process reclaims and cleans fields, making them
count temporarily toward the limit. The delete process runs only when the queue is full, so
it can take days or weeks to start. In the meantime, the deleted fields are still counted as part
of the limit. To request immediate deletion of fields, contact Salesforce Support.
Available in: All Editions
Tabs are not available in
Database.com
See the following for more information:
• Create Custom Fields
USER PERMISSIONS
• Edit Custom Fields
To create or change custom
fields:
• Customize Application
• Manage Fields for a Specific Object
• Delete Fields
• Build a Formula Field
• Create a Custom Picklist Field
• Define Dependent Picklists
• Define Default Field Values
• Additional Custom Field Options
• Custom Field Attributes
• Change the Custom Field Type
132
Extend Salesforce with Clicks, Not Code
Customize Fields
Create Custom Fields
Capture your unique business data by storing it in custom fields. When you create a custom field,
you configure where you want it to appear and optionally control security at the field level.
EDITIONS
Watch a Demo:
Available in: both Salesforce
Classic and Lightning
Experience
How to Create a Custom Field in Salesforce
Want to customize Salesforce so it captures all your business data? This short video walks you
through how to create a custom picklist field, from choosing the correct field type to applying field
level security.
Before you begin, determine the type of field you want to create.
Note: When your org is close to the limit of 800 custom fields and you delete or create fields,
field creation can fail. The physical delete process reclaims and cleans fields, making them
count temporarily toward the limit. The delete process runs only when the queue is full, so
it can take days or weeks to start. In the meantime, the deleted fields are still counted as part
of the limit. To request immediate deletion of fields, contact Salesforce Support.
1. From the management settings for the object you want to add a field to, go to Fields.
Custom task and event fields are accessible from the object management settings for Activities.
2. Click New.
Tip: On custom objects, you can also set field dependencies and field history tracking in
this section.
3. Choose the type of field and click Next. Consider the following.
• Some data types are available for certain configurations only. For example, the
Master-Detail Relationship option is available for custom objects only when
the custom object doesn’t already have a master-detail relationship.
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Salesforce Connect external
objects are available in:
Developer Edition and for
an extra cost in: Enterprise,
Performance, and
Unlimited Editions
Custom fields aren’t
available on Activities in
Group Edition
Custom settings aren’t
available in Professional
Edition
Layouts aren’t available in
Database.com
• Custom settings and external objects allow only a subset of the available data types.
• You can’t add a multi-select picklist, rich text area, or dependent picklist custom field to
opportunity splits.
• Relationship fields count towards custom field limits.
• Additional field types may appear if an AppExchange package using those field types is
installed.
USER PERMISSIONS
To create or change custom
fields:
• Customize Application
• The Roll-Up Summary option is available on certain objects only.
• Field types correspond to API data types.
• If your organization uses Shield Platform Encryption, ensure you understand how to encrypt custom fields using the Shield
Platform Encryption offering.
4. For relationship fields, associate an object with the field and click Next.
5. For indirect lookup relationship fields, select a unique, external ID field on the parent object, and then click Next. The parent field
values are matched against the values of the child indirect lookup relationship field to determine which records are related to each
other.
6. To base a picklist field on a global picklist value set, select the value set to use.
7. Enter a field label.
Salesforce populates Field Name using the field label. This name can contain only underscores and alphanumeric characters,
and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two
133
Extend Salesforce with Clicks, Not Code
Customize Fields
consecutive underscores. Use the field name for merge fields in custom links, custom s-controls, and when referencing the field
from the API.
Tip: Ensure that the custom field name and label are unique for that object.
• If a standard and custom field have identical names or labels, the merge field displays the custom field value.
• If two custom fields have identical names or labels, the merge field may display an unexpected value.
If you create a field label called Email and a standard field labeled Email already exists, the merge field may be unable
to distinguish between the fields. Adding a character to the custom field name makes it unique. For example, Email2.
8. Enter field attributes and select the appropriate checkboxes to specify whether the field must be populated and what happens if
the record is deleted.
9. For master-detail relationships on custom objects, optionally select Allow reparenting to allow a child record in the master-detail
relationship to be reparented to a different parent record.
10. For relationship fields, optionally create a lookup filter to limit search results for the field. Not available for external objects.
11. Click Next.
12. In Enterprise, Unlimited, Performance, and Developer Editions, specify the field’s access settings for each profile, and click Next.
Access Level
Enabled Settings
Users can read and edit the field.
Visible
Users can read but not edit the field.
Visible and Read-Only
Users can’t read or edit the field.
None
Note:
• When you create a custom field, by default the field isn’t visible or editable for portal profiles, unless the field is universally
required.
13. Choose the page layouts that will display the editable field and click Next.
Field
Location on Page Layout
Normal
Last field in the first two-column section.
Long text area
End of the first one-column section.
User
Bottom of the user detail page.
Universally required
Can’t remove it from page layouts or make read only.
14. For relationship fields, optionally create an associated records related list and add it to page layouts for that object.
• To edit the related list name on page layouts, click Related List Label and enter the new name.
• To add the related list to customized page layouts, select Append related list to users’ existing personal
customizations.
15. Click Save to finish or Save & New to create more custom fields.
134
Extend Salesforce with Clicks, Not Code
Customize Fields
Note: Creating fields may require changing a large number of records at once. To process these changes efficiently, your request
may be queued and you may receive an email notification when the process has completed.
Create a Custom Picklist Field
Create custom picklist fields to let your users select values from lists that you define.
Create a Global Picklist Value Set
Use global picklist value sets to share values across objects and custom picklist fields, and to restrict the picklists to only the values
that you specify.
Make Your Custom Picklist Field Values Global
When you create a custom picklist, it’s only available to the current object. To share the values with other objects, promote the
picklist to a global value set. The original custom picklist references the global value set for its values, and the global value set is also
available to other custom picklists.
Custom Field Types
What’s the Difference between Standard Fields and Custom Fields?
You can add custom fields to standard and custom objects in Salesforce, allowing you to infinitely customize your organization.
Although custom fields are similar to the standard fields that come built-in to Salesforce, there are some differences between standard
fields and custom fields.
Custom Field Attributes
A custom field entry consists of several attributes.
Geolocation Custom Field
The geolocation custom field allows you to identify locations by their latitude and longitude and to calculate distances between
locations.
Manage Fields for a Specific Object
Edit Custom Fields
Delete Fields
Manage Deleted Custom Fields
Deleted custom fields and their data are stored until your org permanently deletes them or 15 days has elapsed, whichever happens
first. Until that time, you can restore the field and its data.
Additional Custom Field Options
Editing Rich Text Area Fields in Records
Use rich area text fields to improve the appearance of text, including adding images and hyperlinks.
Rich Text Area Field Limitations
Keep these limitations in mind when working with rich text area fields.
Classic Encryption for Custom Fields
Restrict other Salesforce users from seeing custom text fields you want to keep private. Only users with the permission “View Encrypted
Data” can see data in encrypted custom text fields.
Time Custom Field (Beta)
Track time, unbound to a date, with this custom field type. The time type is useful for time management, event planning, and project
management.
Add or Edit Picklist Values
Add or edit values in a custom picklist from the fields area of an object. If the picklist uses a global picklist value set, you can change
its values only by editing the global value set. Your changes affect all picklists that inherit their values from that global value set.
135
Extend Salesforce with Clicks, Not Code
Customize Fields
Define Dependent Picklists
Rich Text Editor
Use the rich text editor to format text in custom fields with the rich text area type and in many other features, such as Chatter publisher
and groups.
Change the Custom Field Type
SEE ALSO:
External Object Relationships
Which Standard Fields Can I Encrypt?
Which Custom Fields Can I Encrypt?
What’s the Difference Between Classic Encryption and Shield Platform Encryption?
Encrypt New Files and Attachments
Find Object Management Settings
Map Custom Lead Fields for Lead Conversion
Specify Lookup Search Filter Fields
Create a Custom Picklist Field
Create custom picklist fields to let your users select values from lists that you define.
Watch a Demo:
EDITIONS
Custom Fields: Picklists
You can create these types of picklist fields:
• Local picklist—Lets users select a single value from a list that you define. This picklist is unique
and had its own set of values.
• Shared picklist—Lets users select a single value from a global picklist value set that you define
in Setup. All custom picklist fields that use a global value set inherit its values and can’t have
additional values.
• Multi-select picklist—Allows users to select more than one picklist value from a list that you
define. These fields display each value separated by a semicolon.
Note: You can’t add a multi-select picklist, rich text area, or dependent picklist custom field
to opportunity splits.
Available in: Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To create or change custom
fields:
• Customize Application
1. Go to the fields area of the object you want to create a picklist field for.
2. In the custom fields related list, click New.
3. Select Picklist or Picklist (Multi-Select), and then click Next.
4. Enter a label for the picklist field.
5. To use the values from an existing global picklist, select Use global picklist value set. To use values that you create specifically for
this picklist, select Enter values for the picklist, with each value separated by a new line.
Tip: Provide feedback and suggestions for global picklists in the Global, Restricted Custom Picklists group in the Salesforce
Trailblazer Community.
6. If you didn’t use a global picklist value set, enter picklist values.
Put each value on a separate line. Values can be up to 255 characters long.
136
Extend Salesforce with Clicks, Not Code
Customize Fields
7. Optionally, sort the values alphabetically or use the first value in the list as the default value, or both.
If you select both options, Salesforce alphabetizes the entries and then sets the first alphabetized value as the default.
Note: Don’t assign default values to fields that are both required and unique, because uniqueness errors can result. See Default
Field Values on page 187.
You can use a formula to assign a default value dynamically. For example, you can assign a value based on the current user. The
following formula sets an Opportunity priority to High for all users in the Fast Response Sales profile. Other users see the default
listed in the Values set.
IF($Profile.Name = "Fast Response Sales", "High", "")
For picklists, a valid formula result is either a constant or the API name of an entry in the Values list. The formula result has higher
precedence than the default assigned in the Values list. If the formula doesn’t generate a valid result, the default assigned in the
Values list is entered in the field. If a default is not assigned to the Values list, no value is entered in the picklist field.
8. Choose whether to restrict this picklist’s values to an admin-approved list. Selecting Restrict picklist to the values defined in the
value set prevents users from loading unapproved values through the API.
9. If you’re creating a multi-select picklist, enter how many values you want displayed at a time on edit pages. The number of values
determines the box height.
10. Enter description or help text if desired, and then click Next.
11. Set field-level security for the picklist field, and then click Next.
12. Choose the page layouts on which to include the picklist field.
13. Click Save.
SEE ALSO:
Create Custom Fields
Add or Edit Picklist Values
Create a Global Picklist Value Set
Make Your Custom Picklist Field Values Global
Create a Global Picklist Value Set
Use global picklist value sets to share values across objects and custom picklist fields, and to restrict
the picklists to only the values that you specify.
Note: Give your feedback and suggestions for global picklists in the Global, Restricted Custom
Picklists group in the Salesforce Trailblazer Community.
A custom picklist is tied to a particular object as a field on the object. Unlike a custom picklist field,
a global picklist exists independently as a global picklist value set. Its values are shared with any
picklist that’s based on it.
A global picklist is a restricted picklist by nature. Only a Salesforce admin can add to or modify its
values. Users can’t add unapproved values, even through the API.
Note: You can have up to 500 picklist global value sets in an org. Each global value set, or
restricted picklist, can contain a mix of 1,000 active and inactive values. Unrestricted picklists
can have up to 1,000 active values. There’s no limit on the number of custom picklists that
use global picklist value sets.
1. From Setup, enter Picklist in the Quick Find box, then select Picklist Value Sets.
137
EDITIONS
Available in: Salesforce
Classic and Lightning
Experience
Available in: All Editions
USER PERMISSIONS
To create or change custom
fields:
• Customize Application
Extend Salesforce with Clicks, Not Code
Customize Fields
2. Next to Global Value Sets, click New.
3. Enter a label for the global value set. This name appears in Setup, and when users create a picklist based on this global value set.
4. To tell users what these values are for, enter a specific description of the global value set. This text appears on the Picklist Value Sets
list page in Setup.
5. Enter the values, one per line.
6. Optionally choose to sort the values alphabetically or to use the first value in the list as the default value, or both.
If you select both options, Salesforce alphabetizes the entries and then sets the first alphabetized value as the default.
7. Click Save.
Your global value set is ready to be used in custom picklist fields. To arrange values or re-alphabetize them, use Reorder.
To create a picklist that uses a global picklist value set, see Create a Custom Picklist Field.
To see all the fields where this value set is used, look under Fields Where Used on the global picklist’s detail page.
You can’t undo a custom picklist field’s association with a global value set. If you need a picklist field to use a different global value set,
or different individual values, delete the custom picklist field and create a new one in its place.
As you add new values to an existing global picklist, you can add the new values to all record types that use the picklist. Select Add the
new picklist values to all Record Types that use this Global Value Set; otherwise, you have to add the new values to existing records
types manually.
SEE ALSO:
Manage Inactive Picklist Values
Create a Custom Picklist Field
Make Your Custom Picklist Field Values Global
Make Your Custom Picklist Field Values Global
When you create a custom picklist, it’s only available to the current object. To share the values with
other objects, promote the picklist to a global value set. The original custom picklist references the
global value set for its values, and the global value set is also available to other custom picklists.
Note: After a picklist is promoted to a global value set, you can’t demote it. You manage the
values in the global value set or edit the custom picklist field to use different values.
1. Go to the fields area of the object you want to create a picklist field for.
2. In the Custom Fields related list, click Edit.
EDITIONS
Available in: Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
3. Click Promote to Global Value Set.
To create or change custom
fields:
• Customize Application
138
Extend Salesforce with Clicks, Not Code
Customize Fields
4. Enter a label for the global value set.
5. Accept the Field Name or edit it.
6. Optionally, enter a description to identify it when using the values for other custom picklists.
7. Click Promote to Global Value Set, again.
You can use the new global value set for other fields and manage the values in Picklist Value Sets.
When promoting a custom picklist, be aware of the following.
• You can promote fields that have up to 1,000 values (both active and inactive).
• You can promote only restricted picklists. To promote an unrestricted picklist, convert it to a restricted picklist.
• You cannot promote a field to an existing global value set.
• For an app to help manage picklist values, see Picklist Field Merge Salesforce Lab App.
• You can’t undo a custom picklist field’s association with a global value set. If you need a picklist field to use a different global value
set, or different individual values, delete the custom picklist field and create a new one in its place.
SEE ALSO:
Create a Custom Picklist Field
Create a Global Picklist Value Set
Custom Field Types
When you have data that doesn’t match any of the standard fields, your administrator can create a custom field for that data. For example,
you might want a Middle Name field for contacts.
The first step in creating a custom field is choosing the type of the field. Below is a description of each custom field type. Additional field
types may appear if an AppExchange package using those field types is installed.
Type
Description
Auto Number
Automatically assigns a unique number to each record. The
maximum length of any auto-number field is 30 characters, 20 of
which are reserved for prefix or suffix text. Not available for external
objects.
Checkbox
Allows users to check a box, indicating a true or false attribute of
a record. When using a checkbox field for a report or list view filter,
139
Extend Salesforce with Clicks, Not Code
Type
Customize Fields
Description
use “True” for checked values and “False” for unchecked values.
The Data Import Wizard and the weekly export tool use “1” for
checked values and “0” for unchecked values.
Currency
Allows users to enter a currency amount. The system automatically
formats the field as a currency amount. This can be useful if you
export data to a spreadsheet application. Not available for external
objects.
Note: Salesforce uses the round-half-to-even tie-breaking
rule for currency fields. For example, 23.5 becomes 24, 22.5
becomes 22, −22.5 becomes −22, and −23.5 becomes −24.
Values lose precision after 15 decimal places.
Date
Allows users to enter a date or pick a date from a popup calendar.
In reports, you can limit the data by specific dates using any custom
date field.
Date/Time
Allows users to enter a date or pick a date from a popup calendar
and enter a time of day. They can also add the current date and
time by clicking the date and time link next to the field. The time
of day includes AM or PM notation. In reports, you can limit the
data by specific dates and times using any custom date field.
Email
Allows users to enter an email address of up to 80 characters, which
is validated to ensure proper format. If this field is specified for
contacts or leads, users can choose the address when clicking Send
an Email. Note that you can't use custom email addresses for mass
emails.
Note: This field can be encrypted using Shield Platform
Encryption.
External Lookup Relationship
An external lookup relationship links a child standard, custom, or
external object to a parent external object. When you create an
external lookup relationship field, the standard External ID field on
the parent external object is matched against the values of the
child’s external lookup relationship field. External object field values
come from an external data source.
Formula
Allows users to automatically calculate values based on other values
or fields such as merge fields. Not available for external objects.
Note: Salesforce uses the round half up tie-breaking rule
for numbers in formula fields. For example, 12.345 becomes
12.35 and −12.345 becomes −12.34.
Geolocation
Allows users to specify a location by its latitude and longitude.
Geolocation is a compound field that counts toward your org’s
140
Extend Salesforce with Clicks, Not Code
Type
Customize Fields
Description
limits as three custom fields: one for latitude, one for longitude,
and one for internal use. Not available for external objects.
Hierarchical Relationship
Creates a hierarchical lookup relationship between users. Allows
users to use a lookup field to associate one user with another that
does not directly or indirectly refer to itself. For example, you can
create a custom hierarchical relationship field to store each user's
direct manager.
Indirect Lookup Relationship
An indirect lookup relationship links a child external object to a
parent standard or custom object. When you create an indirect
lookup relationship field on an external object, you specify the
parent object field and the child object field to match and associate
records in the relationship. Specifically, you select a custom unique,
external ID field on the parent object to match against the child’s
indirect lookup relationship field, whose values come from an
external data source.
Lookup Relationship
Creates a relationship between two records so you can associate
them with each other. For example, opportunities have a lookup
relationship with cases that lets you associate a particular case with
an opportunity.
• On a standard or custom object, a lookup relationship creates
a field that allows users to click a lookup icon and select another
record from a popup window.
• On an external object, the lookup relationship field references
18-character Salesforce IDs that are stored in an external data
source. Those IDs are matched against the parent object to
determine which records are related to each other.
On the parent record, you can display a related list to show all of
the records that are linked to it. You can create lookup relationship
fields that link to users, standard objects, or custom objects. If a
lookup field references a record that has been deleted, Salesforce
clears the value of the lookup field by default. Alternatively, you
can choose to prevent records from being deleted if they’re in a
lookup relationship.
Lookup relationship fields are not available in Personal Edition.
Lookup relationship fields to campaign members are not available;
however, lookup relationship fields from campaign members to
standard or custom objects are available.
141
Extend Salesforce with Clicks, Not Code
Customize Fields
Type
Description
Master-Detail Relationship
Creates a relationship between records where the master record
controls certain behaviors of the detail record such as record
deletion and security.
Not available for standard objects or external objects, although
you can create a master-detail relationship field on a custom object
that links to a standard object.
Master-detail relationships cannot be used with campaign
members.
Number
Allows users to enter any number. This is treated as a real number
and any leading zeros are removed.
Note: Salesforce uses the round half up tie-breaking rule
for number fields. For example, 12.345 becomes 12.35 and
−12.345 becomes −12.34. Salesforce rounds numbers
referenced in merge fields according to the user’s locale,
not the number of decimal spaces specified in the number
field configuration.
Percent
Allows users to enter a percentage number as a decimal—for
example, 0.10. The system automatically converts the decimal
to a percentage—for example, 10%.
Note: Values lose precision after 15 decimal places. Also,
if you enter a value with more than 15 decimal places and
add a percent sign to the number, a runtime error occurs.
Phone
Allows users to enter any phone number. Character limit is 40.
Salesforce automatically formats it as a phone number.
If you are using Salesforce CRM Call Center, custom phone fields
are displayed with the
button, allowing click-to-dial
functionality. Consequently, Salesforce recommends that you do
not use a custom phone field for fax numbers.
Note: This field can be encrypted using Shield Platform
Encryption.
Picklist
Lets users select a single value from a list that you define. Available
for external objects only with the cross-org adapter for Salesforce
Connect.
Picklist (Multi-select)
Allows users to select more than one picklist value from a list that
you define. These fields display each value separated by a
semicolon. Available for external objects only with the cross-org
adapter for Salesforce Connect.
Roll-Up Summary
Automatically displays the record count of related records or
calculates the sum, minimum, or maximum value of related records.
142
Extend Salesforce with Clicks, Not Code
Type
Customize Fields
Description
The records must be directly related to the selected record and on
the detail side of a custom master-detail relationship with the
object that contains the roll-up summary field. For example, a
custom field called “Total Number of Guests” displays the number
of guest custom object records in the Guests related list. Not
available for external objects.
Text
Allows users to enter any combination of letters, numbers, or
symbols. You can set a maximum length, up to 255 characters.
Note: This field can be encrypted using Shield Platform
Encryption.
Text (Encrypted)
Allows users to enter any combination of letters, numbers, or
symbols that are stored in encrypted form. You can set a maximum
length of up to 175 characters. Encrypted fields are encrypted with
128-bit master keys and use the Advanced Encryption Standard
(AES) algorithm. You can archive, delete, and import your master
encryption key. To enable master encryption key management,
contact Salesforce. Not available for external objects.
Note: This field can be encrypted using Classic Encryption.
If your org uses Shield Platform Encryption, use Text to
create an encrypted text field.
Text Area
Allows users to enter up to 255 characters that display on separate
lines similar to a Description field.
Text Area (Long)
Allows users to enter up to 131,072 characters that display on
separate lines similar to a Description field. You can set the
length of this field type to a lower limit, if desired. Any length from
256 to 131,072 characters is allowed. The default is 32,768
characters. Note that every time you press Enter within a long
text area field, a line break and a return character are added to the
text. These two characters count toward the 131,072 character
limit. This data type is not available for activities or products on
opportunities. Only the first 254 characters in a rich text area or a
long text area are displayed in a report.
Note: This field can be encrypted using Shield Platform
Encryption.
Text Area (Rich)
With the use of a toolbar, users can format the field content and
add images and hyperlinks. The toolbar allows the user to undo,
redo, bold, italicize, underline, strike-out, add a hyperlink, upload
or link to an image, modify alignment, add a numbered or
non-numbered list, indent, and outdent. The maximum field size
is 131,072 characters, inclusive of all the formatting and HTML tags.
Only the first 254 characters in a rich text area or a long text area
are displayed in a report. The maximum size for uploaded images
143
Extend Salesforce with Clicks, Not Code
Type
Customize Fields
Description
is 1MB. Only gif, jpeg and png file types are supported. Not
available for external objects. There are visual and formatting
differences for rich text areas in Lightning Experience and the
Salesforce app, compared to Salesforce Classic.
URL
Allows users to enter up to 255 characters of any valid website
address. When users click on the field, the URL will open in a
separate browser window. Note that only the first 50 characters
are displayed on the record detail pages.
Note: This field can be encrypted using Shield Platform
Encryption.
SEE ALSO:
Custom Field Attributes
What’s the Difference between Standard Fields and Custom Fields?
You can add custom fields to standard and custom objects in Salesforce, allowing you to infinitely
customize your organization. Although custom fields are similar to the standard fields that come
built-in to Salesforce, there are some differences between standard fields and custom fields.
Custom objects and fields let you tailor which data is stored to fit your organization’s needs. Though
the Force.com database provides several standard objects and accompanying standard fields, you
can easily customize how you track and report on your data.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
Custom objects give you the flexibility to store any type of enterprise data that’s relevant to your
app, by creating objects. For example, if you’re building a recruiting app, you can create custom
objects called Position and Candidate to track information on job openings and candidates, respectively.
Categorize and track your data even more granularly by using custom fields. Like standard objects, custom objects have fields that define
the data for those object records. You can, for example, add a custom number field Years of Experience to the custom candidate
object or a custom text field Description to the custom position object. You can add custom fields to both custom and standard
objects.
See the following for more information:
• Create Custom Fields
• Edit Custom Fields
• Manage Fields for a Specific Object
• Build a Formula Field
• Define Default Field Values
• Additional Custom Field Options
• Custom Field Attributes
• Change the Custom Field Type
144
Extend Salesforce with Clicks, Not Code
Customize Fields
Custom Field Attributes
A custom field entry consists of several attributes.
Field
Description
# Visible Lines
For long text area fields, set the number of lines to be displayed on edit pages.
You can display between 2 and 50 lines (the default is 6 lines). If the text does not
fit in the specified number of visible lines, scroll bars appear. Long text area fields
are fully displayed on detail pages and printable views.
Calculation Options
Determines how a roll-up summary field is recalculated after its properties change.
Choose Automatic calculation to recalculate a field the next time it’s
displayed. Choose Force a mass recalculation of this field
as a safety net option to force recalculation of the roll-up summary field values.
Child Relationship Name
The name used in API SOQL relationship queries.
Data Type
The data type of a field determines what type of information is in the field. For
example, a field with the Number data type contains a positive or negative integer.
For more information on data types, see Custom Field Types on page 139.
Decimal Places
For currency, geolocation, number, and percent fields, this field represents the
number of digits you can enter to the right of a decimal point. The system rounds
the decimal numbers you enter, if necessary. For example, if you enter 4.986
in a field with Decimal Places set to 2, the number rounds to 4.99.
Default Value
The value to apply when a user creates a record. For checkbox custom fields,
choose Checked or Unchecked as the default value to indicate the default when
creating records. Don’t assign default values to fields that are both required and
unique, because uniqueness errors can result. See Default Field Values on page
187.
Description
Text that describes the custom field. This description is for administration purposes
only and doesn’t display to users on record detail and edit pages that include the
field.
Display Format
For auto-number fields, enter a Display Format to control formatting
details such as the minimum number of leading zeros and any prefix or suffix for
the number.
Begin by entering the required minimum {0} as a placeholder for the auto-number
without any leading zeros. Add any prefix to your number before this placeholder
and insert any suffix text after the placeholder. Insert any date prefixes or suffixes
in the form of {YY}, {YYYY}, {MM}, or {DD}, which represent the record creation
date in Greenwich Mean Time (GMT).
For information on using auto-number formats when entering your Display
Format, see Auto-Number Formatting Examples on page 150.
Encrypted
If checked, this custom field is encrypted using Shield Platform Encryption.
Note: This page is about Shield Platform Encryption, not Classic
Encryption. What's the difference?
145
Extend Salesforce with Clicks, Not Code
Customize Fields
Field
Description
External Column Name
Available on external objects only. Maps the custom field to an external data
source’s table column.
For a lookup relationship field, specify the external table column that contains
18-character Salesforce IDs.
External ID
For each object that can have custom fields, you can set up to seven custom
auto-number, email, number, or text fields as external IDs. An external ID field
contains record identifiers from a system outside of Salesforce.
You can use an external ID field to update or upsert records using the API. When
using the API or the Data Import Wizard for custom objects and solutions, you
can use this field to prevent duplicates by also marking the field as Unique.
Note: Custom fields marked as Unique count against an object's limit
of seven External ID fields. Custom indexing that occurs
automatically in the background by Salesforce does not count against
External ID limits.
Not available for external objects. Each external object has an External ID
standard field. Its values uniquely identify each external object record in your org.
Filter Criteria
The criteria used to select a group of records to calculate the value of a roll-up
summary field.
Filtering Disabled
For custom fields on external objects, determines whether the field is available
in filters.
Formulas
Enter the formula for the custom formula field or custom summary formula for
reports.
Help Text
The text that displays in the field-level help hover text for this field.
Is Name Field
For external object fields of type text, specifies this custom field as the name field
for the external object. Not available for text area fields. By default, the External
ID standard field is the name field for the external object.
If you select this checkbox, make sure that the External Column Name specifies
a table column that contains name values. Each external object can have only
one name field.
For internal use only, Salesforce stores the value of the name field from each row
that’s retrieved from the external system. This behavior doesn’t apply to external
objects that are associated with high-data-volume external data sources.
Label
The name of the custom field as you want it to appear.
Latitude and Longitude Display Notation
For geolocation fields, determines how the latitude and longitude notation appears
in the Salesforce interface.
Degrees, Minutes, Seconds
A notation for angular measurement that is based on the number 60: there
are 360 degrees to a circle, 60 minutes to a degree, and 60 seconds to a
minute.
146
Extend Salesforce with Clicks, Not Code
Field
Customize Fields
Description
Decimal
Expresses the value as degrees, and converts the minutes and seconds to a
decimal fraction of the degree. Decimal notation doesn’t use cardinal points.
North and East are positive values; South and West are negative values.
For example, the coordinates for San Francisco can be expressed as follows:
Latitude
Longitude
Degrees,
Minutes,
Seconds
37° 46' 30" N
122° 25' 5" W
Decimals
37.794016°
–122.395016°
Regardless of the notation you choose to display in the interface, latitude and
longitude are stored in Salesforce as decimals.
Length (for text fields)
For text fields, the maximum number of characters that a user can enter in a field
(up to 255 characters).
Length (for number, currency, percent fields)
For number, currency, and percent fields, the number of digits you can enter to
the left of the decimal point, for example, 123.98 for an entry of 3.
Mask Character
For encrypted text fields, determines the character to use for hidden characters.
Available options are * and X.
Mask Type
For text fields encrypted with Classic Encryption, determines which characters
are hidden and the use of dashes in the field. Masked characters are hidden using
the character selected in Mask Character. Available options are:
Mask All Characters
All characters in the field are hidden.
Last Four Characters Clear
All characters are hidden but the last four display.
Credit Card Number
The first 12 characters are hidden and the last four display. Salesforce
automatically inserts a dash after every fourth character.
National Insurance Number
All characters are hidden. Salesforce automatically inserts spaces after each
pair of characters if the field contains nine characters. Use this option for UK
NINO fields.
Social Security Number
The first five characters are hidden and the last four display. Salesforce
automatically inserts a dash after the third and fifth characters.
Social Insurance Number
All characters are hidden but the last three display. Salesforce automatically
inserts a dash after the third and sixth characters.
147
Extend Salesforce with Clicks, Not Code
Customize Fields
Field
Description
Master Object
The object on the master side of a master-detail relationship used to display the
value of a roll-up summary field.
Related List Label
For relationship fields, the title for the related list that displays associated records
on the parent record.
Related To
For relationship fields, the name of the associated object.
Required
Makes the field required everywhere in Salesforce. Not available for external
objects.
You must specify a default value for required campaign member custom fields.
Don’t assign default values to fields that are both required and unique, because
uniqueness errors can result. See Require Field Input to Ensure Data Quality on
page 231.
Roll-Up Type
Starting Number
For roll-up summary fields, choose the type of calculation to make:
Type
Description
COUNT
Totals the number of related records.
SUM
Totals the values in the field you select in the Field to
Aggregate option. Only number, currency, and percent fields
are available.
MIN
Displays the lowest value of the field you select in the Field to
Aggregate option for all directly related records. Only number,
currency, percent, date, and date/time fields are available.
MAX
Displays the highest value of the field you select in the Field
to Aggregate option for all directly related records. Only
number, currency, percent, date, and date/time fields are available.
For auto-number fields, enter a Starting Number that’s less than 1 billion.
Select Generate Auto Number for existing records to
automatically number all current records that begin with the starting number
that you enter. If deselected, the next record that you enter is assigned the starting
number and your older records are blank in this field. For leads, only unconverted
leads are assigned a number.
When you create records, Starting Number’s value increments to store
the number that will be assigned to the next auto-number field created. You can’t
edit Starting Number after creating an auto-number field. To edit a
Starting Number value, change your auto-number field to a text field and
then back to an auto-number field. To restart Starting Number values for
fields on objects from a managed package, uninstall and then reinstall the package.
Warning: Be sure that you don’t create records with duplicate
auto-number values.
148
Extend Salesforce with Clicks, Not Code
Field
Customize Fields
Description
An auto-number field can contain up to 10 digits and up to 20 extra characters
for your prefix or suffix.
Note:
• You can’t retrieve the starting number of an auto-number field through
Metadata API. To specify a Starting Number while deploying,
add a startingNumber tag for your field to your package.xml
file. For example:
<startingNumber>42</startingNumber>
• If you deploy without specifying a Starting Number value in
your package.xml file, the default starting number for standard
fields is 0. The default starting number for custom fields is 1.
Sharing Setting
For master-detail relationship fields, the Sharing Setting attribute
determines the sharing access that users must have to a master record to create,
edit, or delete its associated detail records.
Sorting Disabled
For custom fields on external objects, determines whether the field is sortable.
Summarized Object
The object on the detail side of a master-detail relationship used to provide the
values calculated in a roll-up summary field.
Unique
If checked, prevents duplicate field values.
For text fields, you can control whether values that are identical except for their
case are considered unique. Select Treat "ABC" and "abc" as
duplicate values to enforce case-insensitive uniqueness, or select Treat
"ABC" and "abc" as different values to enforce case-sensitive
uniqueness.
Note: Some characters have both single-byte and double-byte versions.
For example, all the following characters have single-byte and double-byte
versions: “!@#$%^&*(){}[]\|:";',.<>?/~`”.
For the purpose of unique field value comparison, the single-byte and
double-byte versions of these characters are considered identical.
Superscript characters are not treated as unique characters. Text such as
ABC² and ABC2 are considered identical.
Note: Custom fields marked as Unique count against an object's limit
of seven External ID fields. Custom indexing that occurs
automatically in the background by Salesforce does not count against
External ID limits.
Values
For picklist fields, a list of available values (up to 255 characters for each value).
For picklists, optionally choose to alphabetize the picklist entries. You can also
set the first value as the default selection. If you select both options, Salesforce
alphabetizes the entries and then sets the first alphabetized value as the default.
For multi-select picklists, enter a list of values, select the sorting options that apply,
149
Extend Salesforce with Clicks, Not Code
Field
Customize Fields
Description
and then enter how many values you want displayed at a time on edit pages.
The number of values determines the box height.
Auto-Number Formatting Examples
Use these examples when setting the display format for auto-number fields.
Format
Displayed Values
{0}
3 66 103
{000}
003 066 103
Sample- {00000}
Sample- 00003 Sample- 00666 Sample- 10023
Value- {00} {MM} {DD} {YY}
Value- 03 12 02 04 Value- 76 03 03 04 Value- 123 11 09 04
PO #{0} {MM}-{DD}-{YY}
PO #12233 12-20-04 PO #25 06-07-04 PO #3 07-07-04
SEE ALSO:
Create Custom Fields
Create a Many-to-Many Relationship
Object Reference for Salesforce and Force.com
Geolocation Custom Field
The geolocation custom field allows you to identify locations by their latitude and longitude and
to calculate distances between locations.
EDITIONS
You can calculate the distance between two geolocation fields, such as between a warehouse and
a store. Or you can calculate the distance between a geolocation field and a pair of latitude and
longitude coordinates, such as between a warehouse and 37.794016°, -122.395016°—the location
also known as San Francisco. Latitude values must be within -90 and 90. Longitude values must
be within -180 and 180.
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
Geolocation is a compound field that counts toward your org’s limits as three custom fields: one
for latitude, one for longitude, and one for internal use. Support for the compound field (geolocation) versus the field’s components
(latitude and longitude) varies depending on the functionality you’re using in Salesforce. For example, you can create list views that
show the field and its components, but you can’t select the compound geolocation field in Apex. You can run SOQL queries only on a
geolocation field’s components.
Compound fields, including geolocation fields, have the following limitations.
• Compound fields are read-only. To update field values, modify the individual field components.
• Compound fields are accessible only through the SOAP and REST APIs. The compound versions of fields aren’t accessible anywhere
in the Salesforce user interface.
150
Extend Salesforce with Clicks, Not Code
Customize Fields
• Although compound fields can be queried with the Location and Address Apex classes, they’re editable only as components
of the actual field. Read and set geolocation field components by appending “__latitude__s” or “__longitude__s” to the field name,
instead of the usual “__c.” For example:
Double theLatitude = myObject__c.aLocation__latitude__s;
myObject__c.aLocation__longitude__s = theLongitude;
You can’t access or set the compound value.
• You can’t use compound fields in Visualforce—for example, in an <apex:outputField>. To access or update field values, use
the individual field components.
• If you select compound fields for export in the Data Loader, they cause error messages. To export values, use individual field
components.
• Custom geolocation and location fields on standard addresses aren’t supported with email templates.
• You can’t use compound fields in lookup filters, except to filter distances that are within or not within given ranges. You can use
distance lookup filters only in the Metadata API.
• The only formula functions that you can use with compound fields are ISBLANK, ISCHANGED, and ISNULL. You can’t use
BLANKVALUE, CASE, NULLVALUE, PRIORVALUE, or the equality and comparison operators with compound fields. The
equality and comparison operators include = and == (equal), <> and != (not equal), < (less than), > (greater than), <= (less
than or equal), >= (greater than or equal), && (AND), and || (OR).
Other limitations of geolocation fields include:
• Geolocation fields aren’t supported in custom settings.
• Geolocation fields aren’t available in dashboards or Schema Builder.
• Geolocation fields are available in Visual Workflow and in formula-based workflow and approvals, but they can’t be used in filter-based
workflow updates and approvals.
• DISTANCE formulas are supported in:
– Entry criteria for workflow rules and approval processes
– Field update actions in workflow rules and approval processes
– Custom validation rules
– Lookup filters (in the Metadata API only)
• Geolocation fields and latitude and longitude on standard addresses aren’t supported in Salesforce to Salesforce.
• In Developer, Professional, Enterprise, Unlimited, and Performance editions, Salesforce can automatically add or update geolocation
fields for Account, Contact, Lead, and WorkOrder records. To use this feature, your administrator must enable the geo data integration
rule for each object. For all other objects and editions, set values for latitude and longitude by using SOQL, Workbench, SOAP or
REST API, or a geocoding service. You can then use address fields as locatable values. To find geocoding services, search AppExchange.
• Geolocation fields are supported in SOQL with the following limitations.
– DISTANCE and GEOLOCATION are supported in WHERE and ORDER BY clauses in SOQL, but not in GROUP BY.
DISTANCE is supported in SELECT clauses.
– DISTANCE supports only the logical operators > and <, returning values within (<) or beyond (>) a specified radius.
– When using the GEOLOCATION function in SOQL queries, the geolocation field must precede the latitude and longitude
coordinates. For example, DISTANCE(warehouse_location__c, GEOLOCATION(37.775,-122.418),
'km') works but DISTANCE(GEOLOCATION(37.775,-122.418), warehouse_location__c, 'km')
doesn’t work.
151
Extend Salesforce with Clicks, Not Code
Customize Fields
– Apex bind variables aren’t supported for the units parameter in DISTANCE or GEOLOCATION functions. This query doesn’t
work.
String units = 'mi';
List<Account> accountList =
[SELECT ID, Name, BillingLatitude, BillingLongitude
FROM Account
WHERE DISTANCE(My_Location_Field__c, GEOLOCATION(10,10), :units) < 10];
For more information and examples, see the Force.com SOQL and SOSL Reference.
SEE ALSO:
Custom Field Types
Custom Field Attributes
Manage Fields for a Specific Object
1. From the object management settings for the object whose fields you want to view, go to
Fields.
EDITIONS
2. Click the field label.
Available in: both Salesforce
Classic and Lightning
Experience
3. To modify a custom field, add custom help text, or change the data type, click Edit.
4. If a custom field exists in a Managed - Released package, click Delete to delete the custom field
component from future installations.
6. To view who can access the field based on permissions and record type, click View Field
Accessibility. This option is available depending on the edition that you have.
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
7. If the custom field is a dependent picklist, click Change next to the controlling field to edit the
dependency rules.
Standard fields are not
available in Database.com
5. To set users’ access to the field, click Set Field-Level Security. This option is available depending
on the edition that you have.
8. To change External ID, Required, or other attributes under the General Options
section, see Custom Field Attributes.
9. To restore the field and its data, click Undelete. This option is available only if the field has been
deleted but not permanently erased. The field’s behavior may be different after restoring it. To
restore the field completely, see Manage Deleted Custom Fields.
Note: If your organization uses person accounts, the Account Fields page lists both person
account and business account fields.
Person accounts use a combination of account and contact fields. The following contact fields
are available for person accounts, but not for business accounts.
• Fields in the Account Standard Fields list that display with a person account icon.
• Fields in the Contact Custom Fields & Relationships list.
SEE ALSO:
Create Custom Data Sets
152
Salesforce Connect external
objects are available in:
Developer Edition and for
an extra cost in: Enterprise,
Performance, and
Unlimited Editions
Extend Salesforce with Clicks, Not Code
Customize Fields
Edit Custom Fields
1. From the management settings for the field’s object, go to Fields.
EDITIONS
2. Click Edit next to the field’s name.
3. Modify the field attributes. The attributes differ depending on the field type.
If you’re editing a picklist, you can change its definition and its values. For picklist settings, see
Add or Edit Picklist Values on page 166.
To change the type of this custom field, see Change the Custom Field Type on page 183.
4. Optionally, define custom help text for the field.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
Standard Objects are not
available in Database.com
5. For lookup and master-detail relationship fields, optionally define a lookup filter.
6. For formula fields, click Next to modify the formula.
USER PERMISSIONS
7. In Enterprise, Unlimited, Performance, and Developer Editions, click Next to set the field-level
security for the field.
To create or change fields:
• Customize Application
Note:
• Editing fields may require changing a large number of records at once. To process these
changes efficiently, your request may be queued and you may receive an email notification
when the process has completed.
• To customize the way a custom object’s related list appears on a parent record’s detail
page, edit the parent record’s page layout. For example, if you want to edit which fields
appear on a custom object’s related list on accounts, you would edit the account page
layout.
• You cannot change the Field Name if a custom field is referenced in Apex.
• When editing fields for accounts, opportunities, cases, contacts, or custom objects, check
for any criteria-based sharing rules that use the field in the rules. A field change may affect
which records are shared.
SEE ALSO:
Define Default Field Values
Find Object Management Settings
Delete Fields
1. From the management settings for the field’s object, go to Fields.
EDITIONS
2. Click Del next to the name of the field.
3. When prompted, select the Yes, I want to delete the custom field
checkbox to confirm, and click Delete.
Deleted custom fields and their data are stored until your org permanently deletes them or 15
days has elapsed, whichever happens first. Until that time, you can restore the field and its data.
For information on restoring deleted custom fields and relationships, see Manage Deleted
Custom Fields on page 154.
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To delete custom fields:
• Customize Application
153
Extend Salesforce with Clicks, Not Code
Customize Fields
Note:
• Before deleting a custom field, consider where it’s referenced. You can’t delete a custom field that’s referenced elsewhere. For
example, you can’t delete a custom field that’s referenced by a field update or Apex.
• You can’t delete a field if that field is being updated by a background job, such as an update to a roll-up summary field. Wait
until the background job finishes, and try again.
• When you delete a custom field, all of the field history data is deleted and changes are no longer tracked.
• A background process periodically runs that cleans up metadata associated with deleted custom fields. This process will affect
the Last Modified Date and Last Modified By fields on page layouts, record types, and custom objects.
SEE ALSO:
Find Object Management Settings
Manage Deleted Custom Fields
Deleted custom fields and their data are stored until your org permanently deletes them or 15 days
has elapsed, whichever happens first. Until that time, you can restore the field and its data.
EDITIONS
However, the field still counts against the maximum number of custom fields allowed in your
organization. A deleted field also counts against any applicable limit for its field type. For example,
a deleted custom roll-up summary field counts against the maximum number of roll-up summary
fields for your Salesforce edition.
Available in: both Salesforce
Classic and Lightning
Experience
1. From the management settings for the field’s object, go to Fields.
2. Click Deleted Fields at the bottom of the list of custom fields and relationships. The number
in parentheses indicates the total number of deleted custom fields for this object. This link only
displays when you have a deleted custom field.
3. Use the list of deleted fields to perform the following actions:
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
• To permanently remove the custom field and its data, click Erase.
Page Layouts and Lead
Fields are not available in
Database.com
• To restore the field and its data, click Undelete. Some attributes of deleted fields are not
restored automatically. To restore these attributes manually:
USER PERMISSIONS
• To view details about a field, click the field label.
a. Add the field to any page layouts that changed during the time the custom field was
deleted. If reports and page layouts were not edited, the restored field remains on them.
b. Make the field unique if necessary. Salesforce automatically removes the unique attribute
from any deleted custom field.
c. Make the field required if necessary. Salesforce automatically removes the required
attribute for any deleted custom field.
d. Add the custom field to any appropriate Force.com AppExchange packages. Salesforce
automatically removes deleted custom fields from packages that contain them.
To restore deleted custom
fields and relationships:
• Customize Application
To permanently delete
custom fields or
relationships:
• Customize Application
e. Convert any lookup relationships to master-detail relationships if necessary. Salesforce converts all relationships to lookup
relationships when they are deleted. To convert a lookup relationship to a master-detail relationship, populate all the
applicable records with the appropriate data.
f. Redefine any field dependencies that Salesforce removed when the field was deleted.
g. Edit and save any formula fields. Saving prompts a syntax check; if necessary, resolve errors.
154
Extend Salesforce with Clicks, Not Code
Customize Fields
h. Set up field history tracking if necessary. If the list of fields enabled for history tracking was modified during the deletion
process, the restored field is no longer set up to track field history.
Notes on Restored Custom Fields
• When deleted, the following characters are appended to the end of a custom field's developer name unless a deleted field already
has that developer name: “_del”. These characters remain when you restore the custom field.
• Formula fields are restored in a disabled state, which means they do not contain updated data until you edit and save them. While
a formula field is disabled, “#Error!” displays in place of the formula value.
• Restored fields do not display in search results immediately after you restore them. It can take a short time before the restored custom
field and its data are available in search results.
• Lead fields that are mapped to account, contact, or opportunity fields for lead conversion are still mapped accordingly when restored.
• Auto number fields continue to increment after they are deleted and contain the correct values when restored.
• Field history data for the deleted custom field is restored.
SEE ALSO:
Find Object Management Settings
Additional Custom Field Options
Changing Page Layouts
To change the location of a new custom field, edit the page layout for the appropriate tab.
Using Record Types
If your organization uses record types, edit the record type to modify which picklist values are visible for the record type.
Tracking Custom Field History
You can select which custom fields to track on the History related list of custom objects and most standard objects. All entries include
the date, time, nature of the change, and who made the change. History data does not count against your organization’s storage
limit.
Using the Translation Workbench
If your organization uses the Translation Workbench, notify your translators that new fields need translations.
Activity Custom Fields
Activity custom fields can apply only to tasks or only to events, or to both tasks and events. For example, you can create one Time
Spent field and then add it to both the event page layout and the task page layout.
Mapping Custom Lead Fields
For lead custom fields, you can click Map Lead Fields to specify which custom lead fields to map to custom account, contact, and
opportunity fields during a lead conversion.
SEE ALSO:
Which Standard Fields Can I Encrypt?
Which Custom Fields Can I Encrypt?
155
Extend Salesforce with Clicks, Not Code
Customize Fields
Editing Rich Text Area Fields in Records
Use rich area text fields to improve the appearance of text, including adding images and hyperlinks.
Rich text area fields use the rich text editor to format content. The rich text editors for custom fields
in Lightning Experience and the Salesforce app come with a few differences, as compared to rich
text editors in Salesforce Classic.
EDITIONS
Available in: the Salesforce
app, Salesforce Classic, and
Lightning Experience
Available in: Essentials,
Contact Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
To create or change custom
fields:
• Customize Application
• The text alignment buttons (1) are displayed after the list and indentation buttons.
• The Remove Formatting button (2) clears text formatting.
• The default font family (3) is Salesforce Sans, Arial, sans-serif, instead of Arial, Verdana, Trebuchet MS, sans-serif.
• The Undo and Redo buttons are no longer available. You can use keyboard shortcuts to undo and redo content formatting. In
Windows, undo your last action by pressing Ctrl+Z, and reverse your last undo by pressing Ctrl+Y. On Mac OS, use Cmd+Z and
Cmd+Y. Alternatively, use the Edit menu in your browser to undo or redo your changes.
Note: We recommend using the toolbar to format your content. The rich text editor provides only a WYSIWYG interface. You
can’t edit HTML tags. When you copy content from a web page or another source and paste it into the editor, unsupported tags
are removed. Text that was enclosed in unsupported tags is preserved as plain text.
Implementation Tips
• Specify the size of the editor box for a rich text field by configuring the Number of lines displayed property in the field’s setup.
• When you view or print content, Salesforce preserves the formatted version of the rich text.
• Searches of content that contains rich text area fields ignore images and tags.
• Deleting a rich text area field moves it to the Deleted Fields section on the custom object or Salesforce Knowledge article types.
• You can only convert rich text area fields into long text area fields. Any images are deleted the next time the long text area field is
saved. After converting, markup is hidden in the long text area field but it is not removed from the record until you save the record.
That way, the markup can be restored if you change your mind.
• The text part of a rich text area field counts toward data storage for the object that contains the field.
Pasting Content from External Sources
• You can copy and paste text from external sources, such as Microsoft® Word, but you might have to reapply formatting.
• JavaScript and CSS are treated as text. For example, if you’re creating an Idea through the API, the JavaScript or CSS code is removed
without warning. Salesforce supports a limited number of approved HTML tags.
• When a rich text area field is used in a formula, the HTML tags are stripped out before the formula is run.
156
Extend Salesforce with Clicks, Not Code
Customize Fields
• Rich text area fields can be filtered and summarized in reports, but HTML tags and special formatting aren’t included in report results.
For example, <b>some</b> <i>text</i> becomes “some text” instead of <b>some</b> <i>text</i> or some text.
• You can use a rich text area field in a mail merge, but the HTML tags are included as text in the resulting document, and images
aren’t merged.
Images in Rich Text Area Fields
• The maximum size of an image that can be uploaded in a rich text area field is 1 MB. You can upload only .gif, .jpg, and .png
file types.
• To upload many images, use API version 20 or later. For more information, see the Force.com SOAP API Developer's Guide.
Note: When you upload images via the API, the alt attribute isn’t populated unless you specified it separately.
• Images uploaded within a rich text area field are extracted in your org’s weekly export and included in the exported data.
• Images in rich text area fields count toward file storage for the object that contains the field.
• You can’t add a hyperlink to an image.
• You can’t upload an image to a rich text area using the file:// protocol in the URL field. Instead, use http:, https:, data:,
//, /, or a relative URL.
• You can’t resize images in Lightning Experience and the Salesforce app.
Formatting Support
The power of the rich text editor is in its WYSIWYG interface, therefore type in the editor and use the toolbar to format your content as
much as you can. When you paste formatted content from another source, you can expect some formatting differences in Lightning
Experience and the Salesforce app. Here are formatting considerations to look out for.
Warning: If you add a custom rich text area field in Salesforce Classic and edit it in Lightning Experience, you can also expect the
formatting differences. Saving your changes in Lightning Experience overwrites the original formatting you had in Salesforce
Classic and conversely. Alternatively, you can fix some of the formatting using the toolbar or switch to Salesforce Classic to perform
your edits.
Definition lists
Formatting for definition lists is preserved, but the styling appears different in Lightning Experience and the Salesforce app. Definition
terms are not bold.
Fonts
Pasting text with a predefined font face, color, or size converts the font tag into a span tag with the style attribute.
Headings
Inline styles on h1, h2, h3, h4, h5, and h6 tags are not supported and are ignored.
Hyperlinks
Hyperlinks always open in a new window or tab in Lightning Experience and the Salesforce app. If you enter a hyperlink with a
different target value in Salesforce Classic and edit the rich text field in Lightning Experience or the app, the target value is
converted to _blank.
Inline styles
In Salesforce Classic, inline styles are supported on div, span, p, br, and hr tags. In Lightning Experience and the Salesforce
app, inline styles are supported only on span tags.
157
Extend Salesforce with Clicks, Not Code
Customize Fields
Lists
Nesting a bulleted list within a numbered list and nesting a numbered list within a bulleted list are not supported. Nesting a numbered
list within a bulleted list (4) converts the numbered list into a bulleted list (5) when it’s pasted into the editor, while nesting a bulleted
list within a numbered list (6) converts the bulleted list into a numbered list (7).
Warning: If you edit an existing rich text area field containing a nested list of a different type in Lightning Experience and
the Salesforce app, the nested list is converted to the same type as its parent list as described previously. Look for continued
improvements for nested lists in future releases.
Nested lists of the same type are supported. However, pasting a nested list into the editor flattens the list into one list in Lightning
Experience and the Salesforce app. For example, a nested bulleted list within a bulleted list (8) becomes a single bulleted list (9)
when pasted. For nested lists of the same type, as shown by (8) and (9), use the toolbar to adjust your list formatting. You can also
press the Tab key or Shift+Tab to create a nested list item or remove a nested list item.
Note: In Lightning Experience and the Salesforce app, pasting lists that are copied from Microsoft® Word is not supported
and results in list items getting converted into paragraphs. Although they look visually like lists, they are pasted as p tags.
Paragraphs
Pressing the Enter key creates a paragraph, which adds padding to the text when saved in Lightning Experience and the Salesforce
app.
Tables
In Salesforce Classic, Lightning Experience, and the Salesforce app, pasting of tables is supported but you can edit only the content
within the tables.
Text-level markup
• Addresses with address tags cause enclosing list formatting to be removed.
• Nested quotes using q tags are not supported.
• Strikethrough text with strike tags are converted to s tags.
• Teletype text with tt tags are converted to code tags.
This table lists supported HTML tags and formatting considerations in Lightning Experience and the Salesforce app. When you edit a
rich text field or paste text with unsupported tags Lightning Experience and the Salesforce app, those tags are removed. Text that was
enclosed in unsupported tags is preserved as plain text.
158
Extend Salesforce with Clicks, Not Code
HTML Tags
Supported in
Salesforce Classic
a
Supported in Custom Fields in
Lightning Experience and the
Salesforce App?
Customize Fields
Comments for Lightning Experience and the Salesforce
App
The target attribute is always set to _blank. This tag is
removed if href has no value.
abbr
acronym
This tag is converted into an abbr tag.
address
When text with this tag is nested in a list and pasted in the editor,
the list tags,ol, li, and ul, are removed. Some tags before the
address tag get nested in address.
b
bdo
big
blockquote
Consecutive block quotes are merged.
br
caption
cite
code
col
colgroup
dd
del
dfn
div
dl
dt
Definition terms are not bold.
em
font
Pasting text with a predefined font face, color, or size converts the
font tag into a span tag with the style attribute.
h1
Inline styles on headings are not supported.
h2
Inline styles on headings are not supported.
h3
Inline styles on headings are not supported.
h4
Inline styles on headings are not supported.
159
Extend Salesforce with Clicks, Not Code
HTML Tags
Supported in
Salesforce Classic
Supported in Custom Fields in
Lightning Experience and the
Salesforce App?
Customize Fields
Comments for Lightning Experience and the Salesforce
App
h5
Inline styles on headings are not supported.
h6
Inline styles on headings are not supported.
hr
i
img
ins
kbd
li
Pasting a nested list of the same type flattens the list into one list,
for example, a nested bulleted list within a bulleted list. Use the
toolbar to adjust your list formatting.
ol
Nesting an ordered list (numbered) in an unordered list (bulleted)
converts the ordered list into an unordered list.
p
pre
q
Nested quotes are not supported.
s
samp
small
span
strike
This tag is nested in a p tag, which adds extra padding around
the text.
This tag is converted into an s tag and is visually the same.
strong
sub
Nested sub tags are merged.
sup
Nested sup tags are merged.
table
tbody
td
tfoot
th
thead
160
Extend Salesforce with Clicks, Not Code
HTML Tags
Supported in
Salesforce Classic
Customize Fields
Supported in Custom Fields in
Lightning Experience and the
Salesforce App?
Comments for Lightning Experience and the Salesforce
App
tr
This tag is converted into a code tag.
tt
u
Nesting an unordered list (bulleted) in an ordered list (numbered)
converts the unordered list into an ordered list.
ul
var
SEE ALSO:
Create Custom Fields
Rich Text Area Field Limitations
Keep these limitations in mind when working with rich text area fields.
Rich text area fields aren’t available in self service portals and they aren’t supported for external
objects. Additionally, consider the following limitations.
Character limits
• Salesforce supports up to 131,072 characters for each rich text area field, including the
HTML tags. If desired, you can set a lower limit.
EDITIONS
Available in: the Salesforce
app, Salesforce Classic, and
Lightning Experience
Available in: Essentials,
Contact Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
• An object can contain unlimited rich text area and long text area fields, although your
edition’s limit for total custom fields allowed on an object, regardless of field type, applies.
Each object can contain 1,600,000 characters across long text area and rich text area fields.
When you create a long text area or rich text area field, you set a character limit for the
field—the maximum length of the text that can be entered. The default character limit for
long text area and rich text area fields is 32,768 (32 KB). The maximum character limit for long text area and rich text area fields
is 131,072 (128 KB). The minimum character limit is 256.
• You can’t paste special characters, such as bullets or curly quotes, into a rich text field from another application. It’s best to type
or paste in plain text and use the rich text editor to format it.
• HTML code isn’t supported in the Salesforce HTML editor. HTML code is treated as text.
Images and Hyperlinks
• You can’t disable specific rich text area features. For example, you can't disable support for hyperlinks or images on certain fields.
• You can’t upload an image to a rich text area using the file:// protocol in the URL field. Instead, use http:, https:,
data:, //, /, or a relative URL.
Reports
• Only the first 254 characters in a rich text area or a long text area are supported with the “contains” operator in a report filter.
• Only the first 254 characters in a rich text area or a long text area are displayed in a report. If you download the report, the entire
field is available.
161
Extend Salesforce with Clicks, Not Code
Customize Fields
Classic Encryption for Custom Fields
Restrict other Salesforce users from seeing custom text fields you want to keep private. Only users
with the permission “View Encrypted Data” can see data in encrypted custom text fields.
Note: This information is about Classic Encryption and not Shield Platform Encryption.
Before you begin working with encrypted custom fields, review these implementation notes,
restrictions, and best practices.
Implementation Notes
• Encrypted fields are encrypted with 128-bit master keys and use the Advanced Encryption
Standard (AES) algorithm. You can archive, delete, and import your master encryption key. To
enable master encryption key management, contact Salesforce.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Developer,
Enterprise, Performance,
Unlimited, and
Database.com Editions
• You can use encrypted fields in email templates but the value is always masked regardless of whether you have the “View Encrypted
Data” permission.
• If you have created encrypted custom fields, make sure that your organization has “Require secure connections (HTTPS)” enabled.
• If you have the “View Encrypted Data” permission and you grant login access to another user, the user can see encrypted fields in
plain text.
• Only users with the “View Encrypted Data” permission can clone the value of an encrypted field when cloning that record.
• Only the <apex:outputField> component supports presenting encrypted fields in Visualforce pages.
Restrictions
Encrypted text fields:
• Cannot be unique, have an external ID, or have default values.
• For leads are not available for mapping to other objects.
• Are limited to 175 characters because of the encryption algorithm.
• Are not available for use in filters such as list views, reports, roll-up summary fields, and rule filters.
• Cannot be used to define report criteria, but they can be included in report results.
• Are not searchable, but they can be included in search results.
• Are not available for: Salesforce Mobile Classic, Connect Offline, Salesforce for Outlook, lead conversion, workflow rule criteria or
formulas, formula fields, outbound messages, default values, and Web-to-Lead and Web-to-Case forms.
Best Practices
• Encrypted fields are editable regardless of whether the user has the “View Encrypted Data” permission. Use validation rules, field-level
security settings, or page layout settings to prevent users from editing encrypted fields.
• You can still validate the values of encrypted fields using validation rules or Apex. Both work regardless of whether the user has the
“View Encrypted Data” permission.
• Encrypted field data is not always masked in the debug log. Encrypted field data is masked if the Apex request originates from an
Apex Web service, a trigger, a workflow, an inline Visualforce page (a page embedded in a page layout), or a Visualforce email
template. In other cases, encrypted field data isn’t masked in the debug log, like for example when running Apex from the Developer
Console.
162
Extend Salesforce with Clicks, Not Code
Customize Fields
• Existing custom fields cannot be converted into encrypted fields nor can encrypted fields be converted into another data type. To
encrypt the values of an existing (unencrypted) field, export the data, create an encrypted custom field to store that data, and import
that data into the new encrypted field.
• Mask Type is not an input mask that ensures the data matches the Mask Type. Use validation rules to ensure that the data
entered matches the mask type selected.
• Use encrypted custom fields only when government regulations require it because they involve more processing and have
search-related limitations.
Note: This page is about Classic Encryption, not Shield Platform Encryption. What's the difference?
SEE ALSO:
Create Custom Fields
Time Custom Field (Beta)
Track time, unbound to a date, with this custom field type. The time type is useful for time management, event planning, and project
management.
Note: This release contains a beta version of the time custom field type, which means it’s a high-quality feature with known
limitations. This feature appears in sandbox and developer edition orgs. For information on enabling this feature in your production
org, contact Salesforce. We can’t guarantee general availability within any particular time frame or at all. Make your purchase
decisions only based on generally available products and features. You can provide feedback and suggestions for the time field
type in the Custom Time Field Trailblazer Community group.
You can select the time field type when you create a custom field. The time type is a timestamp without the date included. Use the time
field type when you require a time of day that is not specific to a single date. For example, use it to display business hours, or if you want
to compare times of the day to calculate a duration.
Time Field Format
The display and management of time field values observes the following behaviors.
• The time custom field type uses a 24-hour notation. You can save a time value in HH:MM, for example, 14:40.
• Salesforce Classic: A time field displays a value based on your organization’s Locale setting on the Company Information page in
Setup.
• Lightning Experience, Quick Actions, and the Salesforce mobile web: A time field displays GMT, always.
• In Reports, time field values display as numbers.
• In formulas, get a time value from the TIMEVALUE function. The new TIMENOW,HOUR, MINUTE, SECOND, and MILLISECOND
functions are also useful for working with time in formulas.
• You can define a default value for a time field, and you can use a formula for the default value.
• The time field type is represented in the Metadata API as a FieldType enumeration value.
Time Field Limitations
Be aware of the following limitations when using a time field type. The time field:
• Cannot be added to records in Automated flows created in Cloud Flow Designer or processes designed in Process Builder.
• Is not supported in Schema Builder.
• Does not have an Aura UI component.
163
Extend Salesforce with Clicks, Not Code
Customize Fields
• Does not support Lightning UI components. If you declare a component with input type "time", then you’ll receive a parsing
error at runtime.
• Cannot be converted to the text or number types.
• Doesn't support the creation of custom index for SOQL queries.
• Is not available for standard lookup relationships in external objects.
Time Data Type and Functions
This beta release also introduces the Time data type and the following new functions for working with time in formulas.
Note: In formula expressions, use the international date format (ISO) for text arguments. For example, use TIMEVALUE("11:30:00.000")
instead of TIMEVALUE("11:30 AM").
HOUR
Description:
Returns the local time hour value without the date in the form of a number from 1 through 12.
Use:
HOUR(time) and replace time with a time value or value such as TIMENOW().
Examples:
HOUR(TIMEVALUE(ClosedDate)) displays only the hour in a time field based on the value
of the Time Closed field.
HOUR(TIMEVALUE("17:30:45.125")) returns 5. In Lightning Experience, this value
displays based on GMT as 17.
MILLISECOND
Description:
Returns a milliseconds value in the form of a number from 0 through 999.
Use:
MILLISECOND(time) and replace time with a time value or value such as TIMENOW().
Examples:
MILLISECOND(TIMEVALUE(ClosedDate)) displays only the milliseconds in a time field
based on the value of the Time Closed field.
MILLISECOND(TIMEVALUE("17:30:45.125")) returns 125.
MINUTE
Description:
Returns a minute value in the form of a number from 0 through 60.
Use:
MINUTE(time) and replace time with a time value or value such as TIMENOW().
Examples:
MINUTE(TIMEVALUE(ClosedDate)) displays only the minutes in a time field based on
the value of the Time Closed field.
MINUTE(TIMEVALUE("17:30:45.125")) returns 30.
164
Extend Salesforce with Clicks, Not Code
Customize Fields
SECOND
Description:
Returns a seconds value in the form of a number from 0 through 60.
Use:
SECOND(time) and replace time with a time value or value such as TIMENOW().
Examples:
SECOND(ClosedDate) displays only the seconds in a time field based on the value of the Time
Closed field.
SECOND(TIMEVALUE("17:30:45.125")) returns 45.
TIMENOW
Description:
Returns a time value in GMT representing the current moment. Use this function instead of the NOW
function if you only want to track time, without a date.
Use:
TIMENOW()
Example:
IF(ISPICKVAL( Rating , "Hot"), TIMENOW(), TIMEVALUE(CreatedDate))
This formula checks to see if a lead is rated “Hot” and if so, returns the current time. Otherwise it
returns the time since someone created the lead.
Tips:
• Do not remove the parentheses.
• Keep the parentheses empty. They do not need to contain a value.
• Use TODAY if you prefer to use a date field.
• The displayed value is based on the organization’s Locale settings.
TIMEVALUE
Description:
Returns the local time value without the date, such as business hours.
Use:
TIMEVALUE(value) and replace value with a date/time or text value, merge field, or
expression.
Examples:
TIMEVALUE(ClosedDate) displays a time value based on the value of the Date/Time Closed
field.
TIMEVALUE("17:30:45.125") returns 5:30 PM. In Lightning Experience, this value displays
in GMT as 17:30:45.125Z.
165
Extend Salesforce with Clicks, Not Code
Tips:
Customize Fields
• The displayed value is based on the organization’s Locale settings.
SEE ALSO:
Create Custom Fields
Supported Locales
Formula Operators and Functions
Using Date and Date/Time Values in Formulas
Custom Field Attributes
Define Default Field Values
Add or Edit Picklist Values
Add or edit values in a custom picklist from the fields area of an object. If the picklist uses a global
picklist value set, you can change its values only by editing the global value set. Your changes affect
all picklists that inherit their values from that global value set.
Note: Changes to picklist values are logged in Setup Audit Trail. To view the audit history:
From Setup, enter View Setup Audit Trail in the Quick Find box, then select
View Setup Audit Trail.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
1. Navigate to the fields area for your object.
2. In the Custom Fields & Relationships related list, click the name of the picklist field to update.
3. In the Values section, click Edit next to a value.
4. Change the value’s name, and optionally make the value the default for the master picklist.
5. Assign a color to use in charts by clicking the
values.
USER PERMISSIONS
To change picklists:
• Customize Application
button and selecting how to assign colors to
• Assign fixed colors to all values assigns a fixed color to each value from the standard set of chart colors. The Chart Colors
column shows the assigned colors. For example, if you want Closed Lost values always to be red in charts grouped by Opportunity
Stage, assign red to that picklist value.
• Assign colors to values dynamically assigns colors when a chart is generated. For example, if you need only certain picklist
values to have fixed colors in charts, manually assign colors to those values and leave the rest to be assigned dynamically.
Note: Chart colors aren’t available for multi-select picklists, currency picklists, or Task Subject, Event Subject, Knowledge
Validation Status, and Opportunity Competitor picklists.
Tip:
• If you use record types, changing the default value of the master picklist doesn’t affect the default value of the picklist for
a record type.
• For Ideas, setting the default value of the Categories or Status picklists doesn’t affect the default value on the Ideas pages.
• If you change the label for a picklist value that’s used as a filter criterion, the picklist value is automatically removed from
the filter criteria. For example, if your report contains a filter where Lead Source equals Email or Web and
you change the picklist value Web to Referral, your report filter changes to Lead Source equals Email. If the
changed picklist value was the only value specified for a particular filter, it continues to show up in your filters, but an error
appears.
166
Extend Salesforce with Clicks, Not Code
Customize Fields
6. Click Save.
7. To make the picklist required (if it’s not already), click Edit at the top of the detail page, and check Always require a value in this
field in order to save a record.
8. To change the picklist from unrestricted to restricted or vice-versa, adjust the Restrict picklist to the values defined in the value
set setting.
9. To open an easy-to-print list of your picklist values, click Printable View.
Note: If your org uses the Translation Workbench, notify your translators that the translations can be outdated when you change
picklist values.
Picklists with Additional Information
Picklist Limitations
Replace Picklist Values
As your business needs change, replace picklist values with more relevant alternatives. Replacing a value globally replaces that field
value on all existing records.
Remove a Picklist Value
Remove or replace custom picklist values to update the records that have the picklist field.
Protect Picklist API Names for Formulas and Integrations
When you create a picklist value, an API Name that matches the Label is assigned. By default, the API Name can be changed at any
time, but you can choose to protect the API Name.
Sort Picklists
Manage Inactive Picklist Values
Deactivate, reactivate, or remove a value from a restricted or unrestricted custom picklist. If it’s a global picklist value set, these actions
simultaneously update all custom picklists that inherit its value set.
SEE ALSO:
Manage Inactive Picklist Values
Manage Inactive Picklist Values
Replace Picklist Values
Protect Picklist API Names for Formulas and Integrations
Picklist Limitations
Picklists with Additional Information
These standard picklist fields have additional information that you can edit.
Picklist
Description
Partner Role (for accounts)
Roles of account partners, for example, Consultant, Supplier. These
options are available when you add an account to the Partners
related list of an account or opportunity.
To edit, from Setup, enter Partner Roles in the Quick
Find box, then select Partner Roles.
167
Extend Salesforce with Clicks, Not Code
Picklist
Customize Fields
Description
Enter the name of the partner role in the “Role” column. In the
“Reverse Role” column, enter the corresponding reverse partner
role. Assigning a partner role to an account creates a reverse partner
relationship so that both accounts list the other as a partner.
Each role and reverse role value can have up to 40 characters.
Priority (for cases)
Urgency of case, for example, Low, High.
If you delete a value, you have the option to map the deleted value
to another existing value in all your org’s cases.
Each picklist value can have up to 40 characters.
Status (for campaign members)
State of a campaign member, for example, Sent or Responded.
If you delete a Status value, you have the option to map the deleted
value to another existing value. The new replacement value is
automatically added to the member status for campaigns that
contained the deleted value.
If the deleted value is the default member status for a campaign,
the new replacement value becomes the default status for that
campaign.
Status (for cases)
State of case, for example, New, On Hold.
If you delete a value, you have the option to map the deleted value
to another existing value in all your org’s cases.
Each picklist value can have up to 40 characters.
Status (for contracts)
State of the contract in the contract business process. You can add
values to this picklist and organize each value into one of several
categories, for example, “Draft”, “In Approval Process”, or
“Activated”. Then sort your contracts using these categories in
reports and views.
Contact Role (for contracts)
Role of a contact on a contract, for example, Business User, Decision
Maker. These options are available when you add a contact to the
Contact Roles related list of a contract.
To edit, from Setup, enter Contact Roles in the Quick
Find box, then select Contact Roles on Contracts.
Each picklist value can have up to 40 characters.
Lead Status (for leads)
State of the lead, for example, Open, Qualified.
Select one value as the “Default Status” assigned to all new leads
created manually, via imports, or via your website. Select one or
more values as the “Converted Status” assigned to converted leads.
When you convert qualified leads into an account, contact, and
opportunity, you can select one of the “Converted” statuses to
assign to the lead. Leads with a “Converted” status type are no
168
Extend Salesforce with Clicks, Not Code
Picklist
Customize Fields
Description
longer available in the Leads tab, although you can include them
in reports.
If you delete a value, you have the option to map the deleted value
to another existing value in all your org’s leads.
Each value can have up to 20 characters.
Contact Role (for opportunities)
Role of a contact for an opportunity, for example, Business User,
Decision Maker. These options are available when you add a contact
to the Contact Roles related list of an opportunity.
To edit, from Setup, enter Contact Roles in the Quick
Find box, then select Contact Roles on Opportunities.
Each picklist value can have up to 40 characters.
Stage (for opportunities)
Sales process stages, for example, Prospect, Proposal. This picklist
also affects the Type and Forecast Category values of
an opportunity. Specifically, changing the Type or Forecast
Category for a Stage picklist value updates all opportunities
that have that stage value.
To edit, from the management settings for opportunities, go to
Fields, and then click Edit next to Stage.
To deactivate an active stage, click Del next to the stage. On the
mapping page, don't replace the stage with another existing value;
just click Save. The stage now appears in the Inactive Stage Picklist
Values related list. The stage is no longer in use but can exist in
older opportunity records.
Status (for solutions)
Status of a solution, for example, Draft, Reviewed. Mark one or more
values as “Reviewed”. When users solve cases using solutions, they
can view which solutions have been reviewed and which have not.
Each picklist value can have up to 40 characters.
Priority (for tasks)
Importance of the task, for example, High, Normal, Low. Set one
value as the default priority of all new tasks, and one value as the
highest priority.
If you delete a value, you have the option to map the deleted value
to another existing value in all your org’s tasks.
Each picklist value can have up to 20 characters.
Status (for tasks)
State of a task, for example, Not Started, Completed. Choose at
least one value as the “Closed” status and one value as the “Default”
status for all new tasks.
If you delete a value, you have the option to map the deleted value
to another existing value in all your org’s tasks.
Each picklist value can have up to 40 characters.
169
Extend Salesforce with Clicks, Not Code
Customize Fields
Picklist
Description
Task Type (for tasks)
Send Email Default specifies the default task type assigned
when the task is sending email or mass email, and when tasks are
created via inbound email, such as Email to Salesforce. Default
specifies the default picklist value when creating tasks.
To edit, from the management settings for tasks, go to Fields, and
then click Edit next to the picklist value that you want to specify
as the default.
SEE ALSO:
Picklist Limitations
Picklist Limitations
The maximum number of characters you can have in a picklist depends on the type of picklist. Each
value in a picklist includes a line break and a return character that aren’t visible. These two additional
characters per value are counted as part of the character limit for each value.
EDITIONS
Additional limits apply to both standard and custom picklists.
Available in: both Salesforce
Classic and Lightning
Experience
Additional Limits for Standard Picklists
Available in: All Editions
For standard picklists, each value can have up to 255 characters, not including line breaks and
returns. This applies to single-select and multi-select picklists.
Standard Picklists are not
available in Database.com
Picklist Field
Maximum Number of Values
Lead Status
100
Task Status
100
Task Priority
50
Case Status
100
Case Priority
50
Opportunity Stage
100
USER PERMISSIONS
To change picklists:
• Customize Application
Limits for Custom Picklists
Custom single-select picklists can have:
• Up to 1,000 values
• Up to 255 characters per value
Custom multi-select picklists can have:
• Up to 500 values
• Up to 255 characters per value
Users can select up to 100 values at a time on a record.
170
Extend Salesforce with Clicks, Not Code
Customize Fields
You can have up to 500 picklist global value sets in an org. Each global value set, or restricted picklist, can contain a mix of 1,000 active
and inactive values. Unrestricted picklists can have up to 1,000 active values. There’s no limit on the number of custom picklists that use
global picklist value sets.
Functional Limitations for Custom Picklists
• You can make a custom picklist field into a restricted picklist only if the picklist has fewer than 1,000 values (or entries). A restricted
picklist’s values are limited to only those values defined by a Salesforce admin. This prevents users from loading redundant or
erroneous values through the API.
• Global picklist value sets are always restricted picklists. This is a good thing, as it preserves data integrity. (Global value sets are shared
across objects. Reuse the value set for any custom picklist field.)
• For custom picklist fields that use a global picklist value set, you can change from a single-select to multi-select picklist and vice
versa. However, you can’t change the picklist to a different field type such as checkbox, currency, or text.
• You can’t undo a custom picklist field’s association with a global value set. If you need a picklist field to use a different global value
set, or different individual values, delete the custom picklist field and create a new one in its place.
Replace Picklist Values
As your business needs change, replace picklist values with more relevant alternatives. Replacing
a value globally replaces that field value on all existing records.
EDITIONS
For example, let’s say you have a status picklist with three different closed values, Closed-red,
Closed-yellow, and Closed-green, and you want to simplify those to just one value. Replace them
with the new value Closed.
Available in: both Salesforce
Classic and Lightning
Experience
Important: If you replace a parent value in a controlling picklist, the picklist dependency on
that value is lost. After replacing the parent value, re-create the dependency using the new
parent value.
1. If necessary, create the replacement value in the picklist edit page. See Add or Edit Picklist
Values.
Available in all editions
USER PERMISSIONS
To replace picklist values:
• Customize Application
2. Navigate to the picklist.
• For a global picklist value set: From Setup, enter picklist in the Quick Find box,
then select Picklist Value Sets.
• For a picklist on an object, go to the fields area of the object. For example, for an Account picklist: From Setup, enter Account
in the Quick Find box, then select Fields under Accounts.
3. Start the picklist value replace process.
• For a global picklist value set: Go to the Global Value Set Detail page by clicking the picklist name. In the Values section, click
Replace.
• For all other picklists: Click Replace next to the picklist name.
4. Enter the value to change, and select a new replacement value.
Note: Replacing an existing picklist value also changes the Modified By date and time for the record.
5. To use the new value in records where this field is currently empty, select Replace all blank values.
6. To update all occurrences of the value in your org’s records with the new value, click Replace. Occurrences in the Recycle Bin are
also updated.
171
Extend Salesforce with Clicks, Not Code
Customize Fields
Your replace job is queued. To check the job’s status, from Setup, enter Background Jobs in the Quick Find box, then select
Background Jobs. You receive an email when the job is complete.
Note: If you replace the Stage picklist for opportunities, the Probability, Forecast Category, and Expected
Revenue fields are also updated with the corresponding values.
SEE ALSO:
Create a Global Picklist Value Set
Protect Picklist API Names for Formulas and Integrations
Manage Inactive Picklist Values
Remove a Picklist Value
Remove or replace custom picklist values to update the records that have the picklist field.
You have several ways to remove existing picklist field values. And, the steps are a little different when your picklist values are part of a
global picklist value set. While you remove them, you can also to replace them with another value. For more information on replacing
an existing value, see Replace Picklist Values. The following steps remove existing values.
1. Navigate to the picklist.
• For a global picklist value set: From Setup, enter picklist in the Quick Find box, then select Picklist Value Sets.
• For a picklist on an object, go to the fields area of the object. For example, for an Account picklist: From Setup, enter Account
in the Quick Find box, then select Fields under Accounts.
2. Click the picklist name.
3. To remove a value from the picklist, click Del next to the value’s name.
Decide whether to replace the value or leave it blank. If you replace it with a blank value, existing records will not display the value
anymore. To keep the value on existing records, use Deactivate, instead of Del.
Note: Some special picklists,such as opportunity Stage, Task Priority, Task Status, Lead Status, and
Case Status,prompt you to map the deleted value to another existing value in all your org’s records. You can map the
values or leave your existing data unchanged.
Using the option to replace a picklist value while deleting the current value does not trigger workflow rules.
For orgs using record types, include some or all the values from the master picklist in different record types to offer a subset of values
to users based on their profile.
172
Extend Salesforce with Clicks, Not Code
Customize Fields
Protect Picklist API Names for Formulas and Integrations
When you create a picklist value, an API Name that matches the Label is assigned. By default, the
API Name can be changed at any time, but you can choose to protect the API Name.
EDITIONS
A picklist value is identified by either the displayed value or the API Name. Formulas reference the
API Name so that the formula continues to work even if the displayed value changes. An admin
can prevent changes to the API Name to protect the references to the fields in formulas or during
integrations, such as data import.
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
1. From Setup, enter picklist in the Quick Find box, then select Picklist Settings.
2. To prevent changes to the API names for any of the values, select Disable editing picklist
values' API names.
If you need to change an API Name later, you can deselect this option.
USER PERMISSIONS
To customize picklist
settings:
• Customize Application
SEE ALSO:
Create a Custom Picklist Field
Replace Picklist Values
Add or Edit Picklist Values
Sort Picklists
1. From the management settings for the picklist field’s object, go to Fields.
Note:
• For custom task or event fields, go to the object management settings for Activities.
• For standard task fields, go to the object management settings for Tasks. For standard
event fields, go to the object management settings for Events.
• For Knowledge validation status picklists, from Setup, enter Validation
Statuses in the Quick Find box, then select Validation Statuses.
2. Click the name of the picklist to update.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To sort picklists:
• Customize Application
3. Click Reorder.
4. Use the arrows to arrange the field in the proper sequence.
5. Select a default value if desired.
6. To alphabetize the entries for users on edit pages, check Sort values alphabetically.... The entries always appear in alphabetical
order, regardless of the user’s language.
7. Save your changes.
Note: On record edit and detail pages and in reports, picklist and multi-select picklist fields can include inactive values. These
inactive values are sorted last, unless you’ve chosen alphabetical sorting. In that case, all values are sorted alphabetically.
SEE ALSO:
Find Object Management Settings
173
Extend Salesforce with Clicks, Not Code
Customize Fields
Manage Inactive Picklist Values
Deactivate, reactivate, or remove a value from a restricted or unrestricted custom picklist. If it’s a
global picklist value set, these actions simultaneously update all custom picklists that inherit its
value set.
Note: Only a Salesforce admin can modify the values of a restricted picklist. Users can’t add
unapproved values, even through the API.
You can’t deactive unrestricted picklist values for the Task.Subject or Event.Subject fields. The
picklist values are deleted instead of deactivated.
EDITIONS
Available in: Salesforce
Classic and Lightning
Experience
Available in: All Editions
USER PERMISSIONS
1. Navigate to the picklist you want to modify.
• For a picklist on an object, go to the fields area of the object.
• For a global picklist: From Setup, enter picklist in the Quick Find box, then select
Picklist Value Sets.
To create or change custom
fields:
• Customize Application
2. Go to the picklist’s detail page by clicking the picklist’s name.
3. In the Values section, modify the picklist value.
• To deactivate a value, which removes it from the picklist but keeps it on existing records: Click Deactivate next to the value’s
name. The value moves to the Inactive Values section. If you need the value again later, click Activate next to its name.
• To remove a value from the picklist and all records that use it: Click Del next to the value’s name and select Replace value on
records with blank value. Then click Save.
• To remove a value from a global picklist and any custom picklists that share its value set: Click Del next to the value’s name and
then click OK. If any custom picklists use this global picklist value set, you’re prompted to replace the value with either a blank
value or an existing, active value. If no custom picklists use the value set, the value is deleted from the global picklist.
Note: If a global picklist value is used in historical trending, it’s deactivated but not deleted.
Deleting a value in a global picklist value set or on non-global, restricted picklists goes to the background jobs queue. When the job
completes, your picklist is updated and you’re notified by email.
Changes to picklist values are logged in Setup Audit Trail. To view the audit history: From Setup, enter View Setup Audit Trail
in the Quick Find box, then select View Setup Audit Trail.
Using the option to replace a picklist value while deleting the current value does not trigger workflow rules.
174
Extend Salesforce with Clicks, Not Code
Customize Fields
Define Dependent Picklists
Tip: If your org uses record types, make sure that your controlling and dependent picklist
values are available in the appropriate record types before defining a dependent picklist.
1. From the management settings for the object you want to add a field to, go to Fields.
Custom task and event fields are accessible from the object management settings for Activities.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
2. Click Field Dependencies.
Available in: All Editions
3. Click New.
Standard Objects are not
available in Database.com
4. Choose a controlling field and dependent field.
Note: Some picklist and checkbox fields may not be available as controlling fields.
USER PERMISSIONS
5. Click Continue.
6. Use the field dependency matrix to specify the dependent picklist values that are available
when a user selects each controlling field value.
To define dependent
picklists:
• Customize Application
7. Optionally, click Preview to test your selections. If your organization uses record types, choose
a record type to test how it affects your controlling and dependent picklist values. The record
type controls what values are available in the controlling field. The record type and the controlling field together determine what
values are available in the dependent picklist. For example, a dependent value is only available if it is available in the selected record
type and the selected controlling value.
Note: The Filter by Record Type option doesn’t appear in the Preview window for activity custom fields.
8. Click Save.
Dependent Picklists
Using the Field Dependency Matrix
Edit Dependent Picklists
Delete Picklist Dependencies
Dependent Picklist Considerations
Dependent Picklists
Use dependent picklists to help your users enter accurate and consistent data. A dependent picklist
is a custom or multi-select picklist for which the valid values depend on the value of another field,
called the controlling field. Controlling fields can be any picklist (with at least one and fewer than
300 values) or checkbox field on the same record.
For example, you can define a Reason custom picklist on opportunities and make its valid values
depend on the value of the Stage picklist as follows:
• If Stage is Closed Won, the valid values for Reason are Superior features or
Lower price.
175
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
Extend Salesforce with Clicks, Not Code
Customize Fields
• If Stage is Closed Lost, the valid values for Reason are Inferior features, Higher price, or Company
viability.
SEE ALSO:
Define Dependent Picklists
Dependent Picklist Considerations
Using the Field Dependency Matrix
The field dependency matrix lets you specify the dependent picklist values that are available when
a user selects each controlling field value. The top row of the matrix contains the controlling field
values, while the columns list the dependent field values.
Use this matrix to include or exclude values. Included values are available in the dependent picklist
when a value in the controlling field is selected. Excluded fields are not available in the dependent
picklist for the selected controlling field value.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
To include or exclude values:
• Double-click values to include them. Included values are indicated with highlighting. Double-click
any highlighted values to exclude them.
• Click a value and use SHIFT+click on another value to select a range of adjacent values. Then
click Include Values to make the values available, or Exclude Values to remove them from
the list of available values.
USER PERMISSIONS
To define picklist
dependencies:
• Customize Application
• Click a value and use CTRL+click to select multiple values. Then click Include Values to make
the values available, or Exclude Values to remove them from the list of available values.
• Click a column header to select all the values in that column. Then click Include Values to make the values available, or Exclude
Values to remove them from the list of available values.
To change the values in your view:
• Click View All to view all available values at once.
• Click Go To and choose a controlling value to view all the dependent values in that column.
• Click Previous or Next to view the values in columns that are on the previous or next page.
• Click View sets of 5 to view 5 columns at a time.
Edit Dependent Picklists
1. From the management settings for the picklist’s object, go to Fields.
EDITIONS
2. Click Field Dependencies.
3. Click Edit next to the field dependency relationship you want to change.
4. Use the field dependency matrix to specify the dependent picklist values that are available
when a user selects each controlling field value.
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
5. Optionally, click Preview to test your selections.
6. Save your changes.
USER PERMISSIONS
SEE ALSO:
To edit field dependencies:
• Customize Application
Find Object Management Settings
176
Extend Salesforce with Clicks, Not Code
Customize Fields
Delete Picklist Dependencies
If you no longer want the values of a dependent picklist to depend on a controlling field, delete its
dependency. Deleting the dependency removes the logic that defines how the values of the picklist
depend on the controlling field, but doesn't delete the fields or affect their data.
1. From the management settings for the picklist’s object, go to Fields.
2. Click Field Dependencies.
3. Click Del next to the field dependency relationship you want to delete.
4. Click OK to confirm.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To delete picklist
dependencies:
• Customize Application
SEE ALSO:
Find Object Management Settings
Dependent Picklist Considerations
Consider the following when defining dependent picklists:
EDITIONS
Checkboxes
Checkbox fields can be controlling fields but not dependent fields.
Converting fields
When you convert existing fields to dependent picklists or controlling fields, it doesn’t affect
the existing values in your records. After conversion, the dependency rules apply to new records
and to any changes to existing records.
Default values
You can set default values for controlling fields but not for dependent picklists.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
Page Layouts and Leads are
not available in
Database.com
Field-level security
Field-level security settings for a controlling field and dependent picklist are independent.
Remember to hide a controlling field whenever its correlating dependent picklist is hidden.
USER PERMISSIONS
Import
The Data Import Wizard doesn’t consider field dependencies. You can import any value into a
dependent picklist regardless of the value imported for a controlling field.
To define and edit
dependent picklists:
• Customize Application
Lead conversion
If you create a dependency for lead fields that map to account, contact, and opportunity fields for lead conversion, create the same
dependency on the account, contact, or opportunity.
Dependent picklists and controlling lead fields can be mapped to account, contact, or opportunity fields with different dependency
rules.
Multi-select picklists
Multi-select picklists can be dependent picklists but not controlling fields.
Standard versus custom picklists
Custom picklist fields can be either controlling or dependent fields.
Standard picklist fields can be controlling fields but not dependent fields.
Picklist limitations
A controlling field can have up to 300 values. If a field is both a controlling field and dependent picklist, it can’t contain more than
300 values.
177
Extend Salesforce with Clicks, Not Code
Customize Fields
The following fields are not available as controlling fields.
Activity Fields
Call Type
Create recurring series of events
Show Time As
Subject
Task
Type
Contact Fields
Salutation
Contact Currency
Custom Object Fields
Currency
Lead Fields
Converted
Unread By Owner
Dependency limitations
Before defining a dependency, make sure that your picklist has at least one value. Standard fields like Product Family do not
contain values until you add them.
If a standard controlling field relies on functionality that your organization decides to disable, the dependency rules for the picklist
go away. For example, if your organization disables the Self-Service portal and the Closed by Self-Service User is a
controlling field, its dependent picklist displays all available values.
If you replace a parent value in a controlling picklist, the picklist dependency is lost. After replacing the parent value, re-create the
dependency using the new parent value.
Connect Offline
While controlling fields and dependent picklists are available in Connect Offline, the logic between them is not.
Page layouts
Page layouts that contain dependent picklists must also contain their controlling picklist fields, or the dependent picklist values don't
display.
For visually impaired users, make sure that the dependent picklist is lower on the page layout than its controlling field.
If a dependent picklist is required and no values are available for it based on the controlling field value, users can save the record
without entering a value. The record is saved with no value for that field.
Record types
You can define or change the record type for your dependent picklist only within the Preview dialog when creating or editing the
field dependency values. The record type controls what values are available in the controlling field. The record type and the controlling
field together determine what values are available in the dependent picklist. For example, a dependent value is only available if it is
available in the selected record type and the selected controlling value.
Rich Text Editor
Use the rich text editor to format text in custom fields with the rich text area type and in many other features, such as Chatter publisher
and groups.
178
Extend Salesforce with Clicks, Not Code
Customize Fields
Available in: the Salesforce app, Salesforce Classic, and Lightning Experience
Available in: All Editions
You can perform the following operations with the rich text editor’s WYSIWYG interface.
• Format text as bold, italicized, underlined, or strikethrough
• Create bulleted and numbered lists
• Change paragraph indentation
• Insert a hyperlink
• Insert an image
• Remove formatting
The availability of toolbar buttons varies across features. For example, the code snippet button is available in Chatter publisher but not
in custom fields.
Note: In Summer ’17, custom fields provide a rich text editor that no longer uses CKEditor in Lightning Experience and the
Salesforce app. Rich text editors provide a WYSIWYG interface only; you can’t edit HTML tags. When you copy content from a web
page or another source and paste it into the editor, unsupported tags are removed. Text that was enclosed in unsupported tags
is preserved as plain text. You aren’t notified when unsupported or potentially malicious HTML tags are removed. You can expect
minor formatting or styling differences when editing a rich text field across the interfaces. We recommend using the toolbar to fix
formatting or styling differences.
Some features have rich text editors across Salesforce Classic, Lightning Experience, and the Salesforce app. For example, the Information
field in groups provides a rich text editor in all three user interfaces, but Chatter Publisher has a rich text editor only in Salesforce Classic
and Lightning Experience.
Salesforce Classic
Lightning Experience
Groups
Lightning Components
(ui:inputRichText and
lightning:inputRichText)
Custom Fields
Chatter Publisher
Knowledge Article
Lightning App Builder (Rich Text
Component)
Community Builder (Rich
Content Editor)
Visual Workflow
Idea Themes
Send Email Action
Sales Path
179
The Salesforce App
Extend Salesforce with Clicks, Not Code
Customize Fields
Salesforce Classic
Lightning Experience
The Salesforce App
Notes
Note: Some features, such as Salesforce Knowledge and Ideas, let administrators enable extra functions, like the ability to embed
multimedia content, use dropdown lists, or select colors for text or background. To use the rich text editors, make sure that JavaScript
is enabled in your browser.
Rich Text Editor Considerations
When you use the editor, note the following.
• The maximum number of characters you can enter in the rich text editor is equal to the field length specified when creating or
editing the field. The default is 32,768 characters.
• Clicked hyperlinks open in a new browser window. The rich text editor supports HTTP, HTTPS, and mailto hyperlinks.
• The rich text editor doesn’t validate hyperlinks to web pages. Confirm that you are specifying a valid URL.
• To insert an image, click
and either select:
– Web Address and enter the URL of the image.
– Upload Image and select an image from your local host. You can upload only JPEG, PNG, or GIF files. The file cannot exceed 1
MB. You can’t add a hyperlink to an image.
Optionally, enter a description that appears when you hover over the image. The image must have a URL that Salesforce can access.
• The rich text editor supports all languages that Salesforce Knowledge supports.
• The rich text editor does not support JavaScript or Cascading Style Sheets (CSS).
• The rich text editor is disabled for users who have accessibility mode enabled. It’s replaced with a text field.
Supported Formatting
We recommend that you use the toolbar to format your content. When you copy content from a web page or another source and paste
it into the editor, unsupported tags are removed. Text that was enclosed in unsupported tags is preserved as plain text. The rich text
editor supports the tags listed in the table.
<a>
<dt>
<q>
<abbr>
<em>
<samp>
<acronym>
<font>
<small>
<address>
<h1>
<span>
<b>
<h2>
<strike>
<bdo>
<h3>
<strong>
<big>
<h4>
<sub>
<blockquote>
<h5>
<sup>
<br>
<h6>
<table>
<caption>
<hr>
<tbody>
180
Extend Salesforce with Clicks, Not Code
Customize Fields
<cite>
<i>
<td>
<code>
<img>
<tfoot>
<col>
<ins>
<th>
<colgroup>
<kbd>
<thead>
<dd>
<li>
<tr>
<del>
<ol>
<tt>
<dfn>
<p>
<ul>
<div>
<pre>
<var>
<dl>
Note: Rich text editors in custom rich text area fields have minor formatting differences in Lightning Experience and the Salesforce
app, as compared to Salesforce Classic. For more information, see Editing Rich Text Area Fields in Records.
The tags can include the following attributes.
alt
face
size
background
height
src
border
href
style
class
name
target
colspan
rowspan
width
The following URL protocols are supported.
• http:
• https:
• file:
• ftp:
• mailto:
• #
• / for relative links
Rich Text Editors Using CKEditor
Rich text editors in Salesforce Classic continue to use CKEditor. In Lightning Experience and the Salesforce app, the following features
have rich text editors that continue to use CKEditor.
• Email Composer, using the Send Email action
• Lightning Knowledge
• Lightning App Builder
• ui:inputRichText component
181
Extend Salesforce with Clicks, Not Code
Customize Fields
Note: The ui:inputRichText component is no longer supported for LockerService. Use lightning:inputRichText
instead.
These features load the rich text editor in an iframe, which means that they don’t load correctly if your browser doesn’t have the appropriate
security settings. Refer to your browser’s instructions to configure the settings. For example, in Internet Explorer, make sure that the
Launching programs and files in an IFRAME security setting is set to Enable or Prompt. In Safari, we recommend changing your
Privacy settings for cookies to Allow from websites I visit. In Chrome, make sure that Block third-party cookies and site data is not
selected in the Content settings.
Additionally, to start typing in the rich text editor on Internet Explorer 11 on touch-enabled devices running Windows, you must click
the rich text area field and tab into the editor first.
Add Videos Using the HTML Editor
Adding Code Samples to Posts
You can paste code samples into your posts in Chatter Answers and Ideas.
SEE ALSO:
Editing Rich Text Area Fields in Records
Add Videos Using the HTML Editor
USER PERMISSIONS
Available in:Salesforce Classic.
Available in: Enterprise, Performance, Unlimited, and Developer Editions
To create or change custom
fields:
• Customize Application
Before you can add videos to the HTML editor in a Knowledge article, make sure that your browser
security settings allow you to embed multimedia content. Some browser security settings can block
<iframe> elements. For example, if browser security is set to high in Internet Explorer 7, <iframe> content does not appear in
the frame.
When the option to embed multimedia content is enabled during the setup of your application, users can cut and paste <iframe>
HTML elements into the editor using one of two options:
1. Copy the <iframe> element from one of the approved video sites.
Approved sites include Dailymotion, Vimeo, or YouTube.
2. Paste the code into the HTML editor by clicking one of these buttons:
Option
Description
Lets you paste the <iframe> element into a text box on the
Embed Multimedia Content dialog box. The frame and its
contents are added to the editor window.
Lets you paste the <iframe> element directly into the HTML
code.
182
Extend Salesforce with Clicks, Not Code
Customize Fields
3. Click Save.
SEE ALSO:
Rich Text Editor
Adding Code Samples to Posts
You can paste code samples into your posts in Chatter Answers and Ideas.
When you enable Chatter Answers and Ideas, users can add code samples to their posts. Code can be copied from any text editor and
pasted into the body of a post with the formatting preserved.
1. Copy the code sample from a text editor to your clipboard.
2.
In the editor, enter the text for your posts and click the
button to add the code sample.
3. Paste the code sample into the Add a code sample text box and click OK.
The code sample appears in the body of the post with its formatting intact.
Change the Custom Field Type
Note: If you encrypt a custom field using Shield Platform Encryption, you can’t change the
field type.
1. From the management settings for the field’s object, go to Fields.
Note: For fields on Salesforce Knowledge article types, from Setup, enter Knowledge
Article Types in the Quick Find box, select Knowledge Article Types, and
then select an article type.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
Standard Objects are not
available in Database.com
2. Click Edit next to the custom field you want to change.
3. Click Change Field Type.
4. Select a new data type and click Next.
5. Enter a field label, name, and any other attributes, and then save your changes.
Notes on Changing Custom Field Types
Salesforce Connect external
objects are available in:
Developer Edition and for
an extra cost in: Enterprise,
Performance, and
Unlimited Editions
USER PERMISSIONS
SEE ALSO:
Custom Field Types
To change custom fields:
• Customize Application
Which Standard Fields Can I Encrypt?
Which Custom Fields Can I Encrypt?
Find Object Management Settings
Notes on Changing Custom Field Types
Consider the following before converting fields:
• Only convert custom fields for which no data exists or you risk losing your data. Changing the data type of an existing custom field
can cause data loss in the following situations:
183
Extend Salesforce with Clicks, Not Code
Customize Fields
– Changing to or from type Date or Date/Time
– Changing to Number from any other type
– Changing to Percent from any other type
– Changing to Currency from any other type
– Changing from Checkbox to any other type
– Changing from Picklist (Multi-Select) to any other type
– Changing to Picklist (Multi-Select) from any other type
Currently defined picklist values are retained when you change a picklist to a multi-select picklist. If records contain values that
are not in the picklist definition, those values are deleted from those records when the data type changes.
– Changing from Auto Number to any other type
– Changing to Auto Number from any type except Text
– Changing from Text to Picklist
– Changing from Text Area (Long) to any type except Email, Phone, Text, Text Area, or URL
• If data is lost, any list view based on the custom field is deleted, and assignment and escalation rules may be affected.
• You can’t change the data type of any custom field that is mapped for lead conversion.
• If you change the data type of a custom field that is set as an external ID, choosing a data type other than text, number, or email
causes the field to no longer act as an external ID.
• The option to change the data type of a custom field is not available for all data types. For example, existing custom fields cannot
be converted into encrypted fields nor can encrypted fields be converted into another data type.
• In Salesforce Knowledge article types, the file field type can't be converted into other data types.
• You cannot change the data type of a custom field referenced by other items in Setup, like Visualforce pages, Apex code, Process
Builder, or flows.
• Changing a custom field type may require changing many records at once. To process these changes efficiently, your request may
be queued and you may receive an email notification when the process has completed.
• Before changing a custom field’s type, make sure that it isn’t the target of a workflow field update or referenced in a field update
formula that would be invalidated by the new type.
The following data types have additional restrictions when you convert them:
Data Type
Description
Auto Number
The data in any auto-number field remains unchanged if you
convert it into a text field. Also, you can safely convert a text custom
field into an auto-number field without losing your data. Converting
an auto-number field into any other data type results in data loss.
Auto-number fields can contain a maximum of 30 characters. Before
converting a text custom field into an auto-number field, change
any records that contain more than 30 characters in that field.
Formula
Formula fields are special read-only fields that cannot be converted
to any other data type. Likewise, you cannot convert any other
field type into a formula field.
Picklist
Changing your custom picklists into custom checkboxes is simple.
If you select Checkbox as the new data type, you can choose which
picklist values to map to checked boxes and unchecked boxes.
184
Extend Salesforce with Clicks, Not Code
Data Type
Customize Fields
Description
You can change custom picklists into multi-select picklists without
losing any data. Since your records only contain a single value of
that picklist, that value is still selected but users can select more
values.
Relationships
• You can convert relationship fields to nonrelationship fields
and vice versa, but only on external objects.
• If your organization has a large number of records, Salesforce
displays a waiting page after you have requested to change a
master-detail into a lookup relationship or a lookup into a
master-detail relationship.
• After you have created a roll-up summary field on an object,
you cannot convert the object's master-detail relationship into
a lookup relationship.
• A lookup cannot be converted to a master detail relationship
if there are any existing records on the object that have a null
value set for the lookup relationship.
• If you are converting a master-detail relationship to a lookup
for a custom object on the “detail” side, the organization-wide
default for the object is automatically updated to Public
Read/Write. Similarly, converting a lookup to a
master-detail-relationship changes the organization-wide
default to Controlled by Parent
Text Area (Long)
When you convert a long text area field to an Email, Phone, Text,
Text Area, or URL type field, the data in your records is truncated
to the first 255 characters of the field.
Text Area (Rich)
You can only convert rich text area fields into long text area fields.
Any images are deleted the next time the long text area field is
saved. After converting, markup is hidden in the long text area field
but it is not removed from the record until you save the record.
That way, the markup can be restored if you change your mind.
SEE ALSO:
Change the Custom Field Type
185
Extend Salesforce with Clicks, Not Code
Customize Fields
Define Default Field Values
Define a default value for a field. Use a formula to generate dynamic values, or constants for static
values.
EDITIONS
To define a default field value:
Available in: both Salesforce
Classic and Lightning
Experience
1. Begin by creating a custom field; see Create Custom Fields on page 133. You can also define a
default value for an existing custom field; see Edit Custom Fields on page 153.
2. Choose the type of field to create and click Next. For a list of the types available for default
values, see Default Field Values on page 187.
3. Enter the attributes for the field.
4. Enter a default value or define a formula to calculate the default value.
Note: You can define a formula for default values only where appropriate. For example,
the default value options for a checkbox field are limited to the options available for those
types of fields, such as Checked or Unchecked.
For picklists, a valid formula result is either a constant or the API name of an entry in the
Values list. The formula result has higher precedence than the default assigned in the
Values list. If the formula doesn’t generate a valid result, the default assigned in the Values
list is entered in the field. If a default is not assigned to the Values list, no value is entered
in the picklist field.
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
To view default field values:
• View Setup and
Configuration
To define or change default
field values:
• Customize Application
5. Click Next.
6. Set the field-level security to determine whether the field should be visible for specific profiles, and click Next.
7. Choose the page layouts that should display the field. The field is added as the last field in the first two-column section on the page
layout. For user custom fields, the field is automatically added to the bottom of the user detail page.
8. Click Save to finish or Save & New to create more custom fields.
Note: You must specify a default value for required campaign member custom fields.
Don’t assign default values to fields that are both required and unique, because uniqueness errors can result.
Default Field Values
Prepopulate field values with defaults to save your users time and improve consistency. Default field values make your users more
productive by reducing the number of fields they need to fill in manually.
Useful Default Field Value Formulas
Default Field Value Considerations
Be aware of the behavior and rules when you assign default values to custom fields.
186
Extend Salesforce with Clicks, Not Code
Customize Fields
Default Field Values
Prepopulate field values with defaults to save your users time and improve consistency. Default
field values make your users more productive by reducing the number of fields they need to fill in
manually.
Default field values automatically insert the value of a custom field when a new record is created.
You can use a default value on a formula for some types of fields or exact values, such as Checked
or Unchecked for checkbox fields.
After you have defined default values:
1. The user chooses to create a new record.
2. Default field value is executed.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
3. Salesforce displays the edit page with the default field value prepopulated.
4. The user enters the fields for the new record.
5. The user saves the new record.
The user can change the field’s value but the initial default field value is only executed once, during record creation. For example, you
can set the default field value on a custom lead field to seven days after the creation date to signify when to contact the lead again. You
can change this value later, but you cannot automatically restore the value that was seven days after the creation date.
Set up default field values for the following types of custom fields:
• Checkbox
• Currency
• Date
• Date/Time
• Email
• Number
• Percent
• Phone
• Picklist
• Text
• Text Area
• URL
For a description of these types, see Custom Field Types on page 139.
SEE ALSO:
Define Default Field Values
187
Extend Salesforce with Clicks, Not Code
Customize Fields
Useful Default Field Value Formulas
EDITIONS
Maximum Discount Rate
Your organization my apply different discount rates to opportunities based on the department of
the person creating the opportunity. Use the following example to set a default value for a custom
field called Discount Rate on opportunities.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
To view default field values:
• View Setup and
Configuration
To define or change default
field values:
• Customize Application
CASE(User.Department, "IT", 0.25, "Field", 0.15, 0)
In this example, the formula inserts a discount rate of 25% on any opportunity created by a user in the “IT” department or 15% on any
opportunity created by someone in the “Field” department. A zero is applied if the creator does not belong to either of these departments.
This is a custom percent field on opportunities that uses the standard user field Department.
Product Language
You may want to associate a product with its language so that your users know the type of documentation or adapter to include. Use
the following default value formula to automatically set the language of a product based on the country of the user creating the product.
In this example, the default value is “Japanese” if the user's country is “Japan” and “English” if the user's country is “US.” If neither is true,
the default value “unknown” is inserted into the Product Language field.
CASE($User.Country , "Japan", "Japanese", "US", "English","unknown")
Tax Rate
Use this default value formula to set the tax rate of an asset based on the user's city. Create a custom percent field with the following
default value:
IF($User.City = "Napa", 0.0750,
IF($User.City = "Paso Robles", 0.0725,
IF($User.City = "Sutter Creek", 0.0725,
IF($User.City = "Los Olivos", 0.0750,
IF($User.City = "Livermore", 0.0875, null
)
)
)
188
Extend Salesforce with Clicks, Not Code
Customize Fields
)
)
In this example, a tax rate of 8.75% is applied to an asset when the user's address is in the city of Livermore. When none of the cities
listed apply, the Tax Rate field is empty. You can also use the Tax Rate field in formulas to automatically calculate taxable
amounts and final sales prices.
SEE ALSO:
Define Default Field Values
Default Field Value Considerations
Be aware of the behavior and rules when you assign default values to custom fields.
Default field values automatically insert the value of a custom field when a new record is created.
You can use a default value on a formula for some types of fields or exact values, such as Checked
or Unchecked for checkbox fields. Review the following considerations before incorporating default
field values in your organization.
• If a default value is based on the value of a merge field, Salesforce uses the value of the merge
field at the time the default value is executed. If the value of the merge field changes later, the
default value is not updated.
• Users can change or remove the default field value on a record.
• Don’t assign default values to fields that are both required and unique, because uniqueness
errors can result.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
• If you make an activity custom field universally required, you must also provide a default value.
• If an activity custom field is unique, you cannot provide a default value.
• Default field values are different from formula fields in the following ways: they are only executed once, at record creation; they are
not read only; and the user can change the value but cannot restore the default field value.
• Since the default value is inserted before users enter any values in the new record, you cannot use the fields on the current record
to create a default field value. For example, you cannot create a default field value on a contact that uses the first initial and last name
because those values are not available when you click New to create a contact record. However, you can use the record type because
it is selected before the record edit page displays.
• To apply a different default value for different record types, use the record type as a merge field in a CASE function within the default
field value setup.
• Fields that are not visible to the user due to field-level security are still available in the formula for a default field value.
• Connect Offline and Salesforce for Outlook do not display default values. However, Salesforce inserts the default values when a user
syncs unless the user entered a value.
• Default field values are not available in the Self-Service portal.
• Lead conversion, Web-to-Lead, and Web-to-Case do not execute default field values.
189
Extend Salesforce with Clicks, Not Code
Customize Fields
Note: You can define a formula for default values only where appropriate. For example, the default value options for a checkbox
field are limited to the options available for those types of fields, such as Checked or Unchecked.
For picklists, a valid formula result is either a constant or the API name of an entry in the Values list. The formula result has higher
precedence than the default assigned in the Values list. If the formula doesn’t generate a valid result, the default assigned in the
Values list is entered in the field. If a default is not assigned to the Values list, no value is entered in the picklist field.
SEE ALSO:
Define Default Field Values
Validation Rules
Improve the quality of your data using validation rules. Validation rules verify that the data a user
enters in a record meets the standards you specify before the user can save the record. A validation
rule can contain a formula or expression that evaluates the data in one or more fields and returns
a value of “True” or “False”. Validation rules also include an error message to display to the user
when the rule returns a value of “True” due to an invalid value.
After you have defined validation rules:
1. The user chooses to create a new record or edit an existing record.
2. The user clicks Save.
3. All validation rules are verified.
• If all data is valid, the record is saved.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
• If any data is invalid, the associated error message displays without saving the record.
4. The user makes the necessary changes and clicks Save again.
You can specify the error message to display when a record fails validation and where to display it. For example, your error message can
be “The close date must occur after today's date.” You can choose to display it near a field or at the top of the page. Like all other error
messages, validation rule errors display in red text and are preceded by the word “Error”.
Important: Validation rules apply to new and updated records for an object, even if the fields referenced in the validation rule
are not included in a page layout or an API call. Validation rules don't apply if you create new records for an object with Quick
Create. If your organization has multiple page layouts for the object on which you create a validation rule, verify that the validation
rule functions as intended on each layout. If your organization has any integrations that use this object, verify that the validation
rule functions as intended for each integration.
Managing Validation Rules
Define Validation Rules
Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record. A
validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or
“False”. Validation rules also include an error message to display to the user when the rule returns a value of “True” due to an invalid
value.
Clone Validation Rules
Activate Validation Rules
Validation Rules Fields
Tips for Writing Validation Rules
190
Extend Salesforce with Clicks, Not Code
Customize Fields
Validation Rule Considerations
Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record. A
validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or
“False”. Validation rules also include an error message to display to the user when the rule returns a value of “True” due to an invalid
value. Review these considerations before implementing validation rules in your organization.
SEE ALSO:
Examples of Validation Rules
Custom Metadata Type Fields and Validation Rules
Managing Validation Rules
Validation rules verify that the data a user enters in a record meets the standards you specify before
the user can save the record. A validation rule can contain a formula or expression that evaluates
the data in one or more fields and returns a value of “True” or “False”. Validation rules also include
an error message to display to the user when the rule returns a value of “True” due to an invalid
value.
From the validation rules page you can:
• Define a validation rule.
• Click Edit next to a rule name to update the rule fields.
• Delete a validation rule.
• Click a validation rule name to view more details or to clone the rule.
• Activate a validation rule.
SEE ALSO:
Examples of Validation Rules
191
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Extend Salesforce with Clicks, Not Code
Customize Fields
Define Validation Rules
Validation rules verify that the data a user enters in a record meets the standards you specify before
the user can save the record. A validation rule can contain a formula or expression that evaluates
the data in one or more fields and returns a value of “True” or “False”. Validation rules also include
an error message to display to the user when the rule returns a value of “True” due to an invalid
value.
Before creating validation rules, review the Validation Rule Considerations.
1. From the management settings for the relevant object, go to Validation Rules.
2. In the Validation Rules related list, click New.
Note: The detail page of a custom activity field does not list associated validation rules.
To edit the validation rule for a custom activity field, select the validation rule from Setup
by entering Activities in the Quick Find box, then selecting Activities and
choose Task Validation Rules or Event Validation Rules.
3. Enter the properties of your validation rule.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
USER PERMISSIONS
To view field validation rules:
• View Setup and
Configuration
4. To check your formula for errors, click Check Syntax.
To define or change field
validation rules:
• Customize Application
SEE ALSO:
Validation Rules
Clone Validation Rules
Tips for Writing Validation Rules
Examples of Validation Rules
Clone Validation Rules
1. From the management settings for the relevant object, go to Validation Rules.
EDITIONS
2. In the Validation Rules related list, click the name of the validation rule.
Available in: both Salesforce
Classic and Lightning
Experience
3. Click Clone.
4. Define the new rule based on the original rule.
5. Click Save to finish or Save & New to create additional validation rules.
Note: The detail page of a custom activity field does not list associated validation rules. To
edit the validation rule for a custom activity field, select the validation rule from Setup by
entering Activities in the Quick Find box, then selecting Activities and choose
Task Validation Rules or Event Validation Rules.
SEE ALSO:
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
USER PERMISSIONS
Define Validation Rules
To view field validation rules:
• View Setup and
Configuration
Validation Rules Fields
Activate Validation Rules
To define or change field
validation rules:
• Customize Application
192
Extend Salesforce with Clicks, Not Code
Customize Fields
Activate Validation Rules
1. From the management settings for the relevant object, go to Validation Rules.
EDITIONS
2. Click Edit next to the rule you want to activate.
3. To activate the rule, select Active, and save your changes.
4. To deactivate the rule, deselect Active, and save your changes.
Note: The detail page of a custom activity field does not list associated validation rules.
SEE ALSO:
Define Validation Rules
Validation Rules Fields
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Find Object Management Settings
USER PERMISSIONS
To view field validation rules:
• View Setup and
Configuration
To define or change field
validation rules:
• Customize Application
Validation Rules Fields
Field
Description
EDITIONS
Rule Name
Unique identifier of up to 40 characters with no spaces or special
characters such as extended characters.
Active
Checkbox that indicates if the rule is enabled.
Available in: both Salesforce
Classic and Lightning
Experience
Description
A 255-character or less description that distinguishes the validation
rule from others. For internal purposes only.
Error Condition
Formula
The expression used to validate the field. See Build a Formula Field
and Formula Operators and Functions.
Error Message
The message that displays to the user when a field fails the
validation rule.
If your organization uses the Translation Workbench, you can
translate the error message into the languages Salesforce supports.
See Enable and Disable the Translation Workbench.
Error Location
Determines where on the page to display the error. To display the
error next to a field, choose Field and select the field. If the
error location is a field, the validation rule is also listed on the detail
page of that field. If the error location is set to a field that is later
deleted, to a field that is read only, or to a field that isn’t visible on
193
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Extend Salesforce with Clicks, Not Code
Field
Customize Fields
Description
the page layout, Salesforce automatically changes the location to Top of Page.
Note: Error messages can only be displayed at the top of the page in validation
rules for case milestones and Ideas.
SEE ALSO:
Define Validation Rules
Tips for Writing Validation Rules
• Consider all the settings in your organization that can make a record fail validation, including
assignment rules, field updates, field-level security, or fields hidden on a page layout.
EDITIONS
• Be careful not to create contradicting validation rules for the same field; otherwise, users won’t
be able to save the record.
Available in: both Salesforce
Classic and Lightning
Experience
Tip: A poorly designed validation rule can prevent users from saving valid data. Make
sure you thoroughly test a validation rule before activating it. You can also use the debug
log to monitor the details of your rule implementation.
• When referencing related fields in a validation formula, make sure those objects are deployed.
• Use the RecordType.Id merge field in your formula to apply different validations for
different record types.
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
• You don’t have to begin a validation rule formula with the IF function. Any Boolean error
condition expression works. For example:
– Correct: CloseDate < TODAY()
– Incorrect: IF(CloseDate < TODAY(), TRUE, FALSE)
• Keep in mind that when a validation rule contains the BEGINS or CONTAINS function, it processes blank fields as valid. For example,
if you have a validation rule that tests whether the serial number of an asset begins with “3”, all assets with a blank serial number
are considered valid.
• When using a validation rule to ensure that a number field contains a specific value, use the ISBLANK function to include fields that
don’t contain any value. For example, to validate that a custom field contains a value of ‘1’, use the following validation rule to display
an error if the field is blank or any other number:
OR (ISBLANK (field__c), field__c<>1)
• Avoid using the IsClosed or IsWon opportunity merge fields in validation formulas. Instead, use the ISPICKVAL function to
determine if the Stage contains the appropriate value. For example, the following validation formula makes a custom Project
Start Date field required whenever the Stage is “Closed Won”:
AND(ISPICKVAL(StageName, "Closed Won"),
ISBLANK(Project_Start_Date__c))
• Simplify your validation formulas by using checkbox fields, which don't require any operator because they return true or false. For
example, the following validation formula checks to be sure an opportunity has opportunity products using the
HasOpportunityLineItem merge field before users can save a change to it:
NOT(OR(ISNEW(),HasOpportunityLineItem))
194
Extend Salesforce with Clicks, Not Code
Customize Fields
Tips for Writing Validation Rule Error Messages
• Give instructions. An error message like “invalid entry” doesn’t tell the user what type of entry is valid. Write something more specific,
such as “Close Date must be after today.”
• Always include the field label. Users might not know what field is failing validation, especially if the error message appears at the
top of the page.
Note: When defining validation rules, you can set the error location to Top of Page or Field. If the error location is
set to a field that is later deleted, to a field that is read only, or to a field that isn’t visible on the page layout, Salesforce
automatically changes the location to Top of Page.
• If you have a multilingual organization, translate your error messages. You can translate error messages using the Translation
Workbench.
• Assign corresponding numbers to validation rules and their error messages. This allows you to identify the source of the error.
SEE ALSO:
Define Validation Rules
Validation Rule Considerations
Validation Rule Considerations
Validation rules verify that the data a user enters in a record meets the standards you specify before
the user can save the record. A validation rule can contain a formula or expression that evaluates
the data in one or more fields and returns a value of “True” or “False”. Validation rules also include
an error message to display to the user when the rule returns a value of “True” due to an invalid
value. Review these considerations before implementing validation rules in your organization.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
How Salesforce Processes Validation Rules
Salesforce processes rules in the following order:
1. Validation rules
2. Assignment rules
3. Auto-response rules
4. Workflow rules (with immediate actions)
5. Escalation rules
In addition,
• When one validation rule fails, Salesforce continues to check other validation rules on that field or other fields n the page and displays
all error messages at once.
• If validation rules exist for activities and you create an activity during lead conversion, the lead converts but a task isn’t created.
• Validation rules are only enforced during lead conversion if validation and triggers for lead conversion are enabled in your organization.
• Campaign hierarchies ignore validation rules.
• Salesforce runs validation rules before it creates records submitted via Web-to-Lead and Web-to-Case and then creates records that
have valid values.
• Validation rules continue to run on individual records if the owner is changed. If the Mass Transfer tool is used to change the ownership
of multiple records, however, validation rules don’t run on those records.
195
Extend Salesforce with Clicks, Not Code
Customize Fields
Validation Rule Field Restrictions
Validation rule formulas don’t or can’t refer to:
• Compound fields, including addresses, first and last names, and dependent picklists and lookups
• Campaign statistic fields, including statistics for individual campaigns and campaign hierarchies
• Merge fields for auto-number or compound address fields such as Mailing Address
Note: Merge fields for individual address fields, such as Billing City, are OK to use in validation rule formulas.
In relation to other fields and functions in Salesforce, validation rules behave as follows:
• The detail page of a custom activity field doesn't list associated validation rules.
• Workflow rules and some processes can invalidate previously valid fields. Invalidation occurs because updates to records based on
workflow rules and also on process scheduled actions don’t trigger validation rules.
• Process record updates on immediate actions do fire validation rules.
• You can’t create validation rules for relationship group members.
• You can use roll-up summary fields in validation rules because the fields don’t display on edit pages. Do not use roll-up summary
fields as the error location.
Lookup Filters vs. Validation Rules
Validation rules and lookup filters achieve similar ends, but offer different advantages. Use a lookup filter if:
• You want to improve user efficiency by limiting the number of available options in a lookup search dialog.
• You want to improve user efficiency by automating filters on lookup search dialogs that your users manually set.
Use a validation rule if:
• You're close to the maximum number of lookup filters allowed.
• You must implement a complex business rule that requires you to use a formula. Formulas can reference fields that basic filter criteria
can't reference, such as fields on the parent of the source object. Formulas can also use functions. For example, use ISNEW if the
rule should only apply on record creation, or ISCHANGED if the rule should apply when a field changes.
SEE ALSO:
Define Validation Rules
Activate Validation Rules
Examples of Validation Rules
196
Extend Salesforce with Clicks, Not Code
Customize Fields
Examples of Validation Rules
Review examples of validation rules for various types of apps that you can use and modify for your
own purposes. Validation rules verify that the data a user enters in a record meets the standards
you specify before the user can save the record.
Use the following samples for validation rules in Salesforce and Force.com AppExchange apps,
including:
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Sample Account Address Validation Rules
Sample Account Validation Rules
Sample Call Center Validation Rules
Sample Community Validation Rules
Sample Contact Validation Rules
USER PERMISSIONS
Sample Cross Object Validation Rules
To view field validation rules:
• View Setup and
Configuration
Sample Date Validation Rules
Sample Number Validation Rules
Sample Opportunity Management Validation Rules
To define or change field
validation rules:
• Customize Application
Sample Quote Validation Rules
Sample User, Role, and Profile Validation Rules
Miscellaneous Sample Validation Rules
SEE ALSO:
Validation Rules
Define Validation Rules
Sample Account Address Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
197
Extend Salesforce with Clicks, Not Code
Customize Fields
Canadian Billing Postal Code
Field
Value
Description:
Validates that the account Billing Zip/Postal Code is in the correct format if
Billing Country is Canada.
Formula:
AND(
OR(BillingCountry = "CAN", BillingCountry = "CA", BillingCountry
= "Canada"),
NOT(REGEX(BillingPostalCode,
"((?i)[ABCEGHJKLMNPRSTVXY]\\d[A-Z]?\\s?\\d[A-Z]\\d)?"))
)
Error Message:
Canadian postal code must be in A9A 9A9 format.
Error Location:
Billing Zip/Postal Code
Billing Zip Code Is in Billing State
Field
Value
Description:
Validates that the account Billing Zip/Postal Code is valid by looking up the first
five characters of the value in a custom object called Zip_Code__c that contains a record for
every valid zip code in the US. If the zip code is not found in the Zip_Code__c object, or the
Billing State does not match the corresponding State_Code__c in the Zip_Code__c
object, an error is displayed.
Formula:
VLOOKUP(
$ObjectType.Zip_Code__c.Fields.City__c ,
$ObjectType.Zip_Code__c.Fields.Name ,
LEFT(BillingPostalCode,5)) <> BillingCity
Error Message:
Billing Zip Code does not exist in specified Billing State.
Error Location:
Billing Zip/Postal Code
198
Extend Salesforce with Clicks, Not Code
Customize Fields
US Billing Zip Code
Field
Value
Description:
Validates that the account Billing Zip/Postal Code is in 99999 or 99999-9999
format if Billing Country is USA or US.
Formula:
AND(
OR(BillingCountry = "USA", BillingCountry = "US"),
NOT(REGEX(BillingPostalCode, "\\d{5}(-\\d{4})?"))
)
Note: This example uses the REGEX function; see Shipping Zip Code if you are not
familiar with regular expressions.
Error Message:
Zip code must be in 99999 or 99999-9999 format.
Error Location:
Billing Zip/Postal Code
199
Extend Salesforce with Clicks, Not Code
Customize Fields
Shipping Zip Code
Field
Value
Description:
Validates that the account Shipping Zip/Postal Code is in 99999 or 99999-9999 format if
Shipping Country is USA or blank.
Formula:
AND(
OR(ShippingCountry = "USA", ISBLANK(ShippingCountry)),
OR(
AND(LEN(ShippingPostalCode) <>5,
LEN(ShippingPostalCode) <> 10),
NOT(CONTAINS("0123456789",
LEFT( ShippingPostalCode, 1))),
NOT(CONTAINS("0123456789",
MID( ShippingPostalCode , 2, 1))),
NOT(CONTAINS("0123456789",
MID( ShippingPostalCode , 3, 1))),
NOT(CONTAINS("0123456789",
MID( ShippingPostalCode , 4, 1))),
NOT(CONTAINS("0123456789",
MID( ShippingPostalCode , 5, 1))),
AND(
LEN(ShippingPostalCode) = 10,
OR(
MID( ShippingPostalCode , 6, 1) <> "-",
NOT(CONTAINS("0123456789",
MID( ShippingPostalCode , 7, 1))),
NOT(CONTAINS("0123456789",
MID( ShippingPostalCode , 8, 1))),
NOT(CONTAINS("0123456789",
MID( ShippingPostalCode , 9, 1))),
NOT(CONTAINS("0123456789",
MID( ShippingPostalCode , 10, 1)))
)
)
)
)
Note: This example interprets a blank country as US. To use this example with other countries,
remove the clause that checks the length of the country field. Also, validation rule criteria are
case sensitive, so this rule is only enforced when the country is blank or “USA” in all capital letters.
The rule is not enforced when the country is “usa.”
Tip: You can also validate zip codes using a regular expression; for an example of a formula
using a regular expression, see REGEX on page 297.
Error Message:
Zip code must be in 99999 or 99999-9999 format.
Error Location:
Shipping Zip/Postal Code
200
Extend Salesforce with Clicks, Not Code
Customize Fields
Valid Billing State (US)
Field
Value
Description:
Validates that the account Billing State/Province is a valid two-character
abbreviation if Billing Country is US, USA, or blank.
Formula:
AND (
OR(BillingCountry = "US", BillingCountry="USA",
ISBLANK(BillingCountry)),
OR(
LEN(BillingState) < 2,
NOT(
CONTAINS("AL:AK:AZ:AR:CA:CO:CT:DE:DC:FL:GA:HI:ID:" &
"IL:IN:IA:KS:KY:LA:ME:MD:MA:MI:MN:MS:MO:MT:NE:NV:NH:" &
"NJ:NM:NY:NC:ND:OH:OK:OR:PA:RI:SC:SD:TN:TX:UT:VT:VA:" &
"WA:WV:WI:WY", BillingState)
)))
Note: This example interprets a blank country as US. To use this example with other
countries, remove the clause that checks the length of the country field. Also, validation
rule criteria are case sensitive, so this rule is only enforced when the country is blank
or “USA” in all capital letters. The rule is not enforced when the country is “usa.”
Error Message:
A valid two-letter state code is required.
Error Location:
Billing State/Province
Valid Billing Province (Canada)
Field
Value
Description:
Validates that the account Billing State/Province is a valid two-character abbreviation if Billing
Country is CA or CAN.
Formula:
AND (
OR(BillingCountry = "CA", BillingCountry="CAN"),
OR(
LEN(BillingState) < 2,
NOT(
CONTAINS("AB:BC:MB:NB:NL:NT:NS:NU:ON:PC:QC:SK:YT", BillingState)
)))
Error Message:
A valid two-letter province code is required.
Error Location:
Billing State/Province
201
Extend Salesforce with Clicks, Not Code
Customize Fields
Valid Shipping State
Field
Value
Description:
Validates that the account Shipping State/Province is a valid two-character abbreviation if
Shipping Country is US, USA, or blank.
Formula:
AND (
OR(ShippingCountry = "US", ShippingCountry="USA",
ISBLANK(ShippingCountry)),
OR(
LEN(ShippingState) < 2,
NOT(
CONTAINS("AL:AK:AZ:AR:CA:CO:CT:DE:DC:FL:GA:HI:ID:" &
"IL:IN:IA:KS:KY:LA:ME:MD:MA:MI:MN:MS:MO:MT:NE:NV:NH:" &
"NJ:NM:NY:NC:ND:OH:OK:OR:PA:RI:SC:SD:TN:TX:UT:VT:VA:" &
"WA:WV:WI:WY", ShippingState)
)))
Note: This example interprets a blank country as US. To use this example with other countries, remove
the clause that checks the length of the country field. Also, validation rule criteria are case sensitive,
so this rule is only enforced when the country is blank or “USA” in all capital letters. The rule is not
enforced when the country is “usa.”
Error Message:
A valid two-letter state abbreviation is required.
Error Location:
Shipping State/Province
Valid Shipping Province (Canada)
Field
Value
Description:
Validates that the account Shipping State/Province is a valid two-character abbreviation, if
Billing Country is CA or CAN.
Formula:
AND (
OR(ShippingCountry = "CA", ShippingCountry="CAN"),
OR(
LEN(ShippingState) < 2,
NOT(
CONTAINS("AB:BC:MB:NB:NL:NT:NS:NU:ON:PC:QC:SK:YT", ShippingState)
)))
Error Message:
A valid two-letter province abbreviation is required.
Error Location:
Shipping State/Province
202
Extend Salesforce with Clicks, Not Code
Customize Fields
Valid Billing Country
Field
Value
Description:
Validates that the account Billing Country is a valid ISO 3166 two-letter code.
Formula:
OR(
LEN(BillingCountry) = 1,
NOT(
CONTAINS(
"AF:AX:AL:DZ:AS:AD:AO:AI:AQ:AG:AR:AM:" &
"AW:AU:AZ:BS:BH:BD:BB:BY:BE:BZ:BJ:BM:BT:BO:" &
"BA:BW:BV:BR:IO:BN:BG:BF:BI:KH:CM:CA:CV:KY:" &
"CF:TD:CL:CN:CX:CC:CO:KM:CG:CD:CK:CR:CI:HR:" &
"CU:CY:CZ:DK:DJ:DM:DO:EC:EG:SV:GQ:ER:EE:ET:FK:" &
"FO:FJ:FI:FR:GF:PF:TF:GA:GM:GE:DE:GH:GI:GR:GL:" &
"GD:GP:GU:GT:GG:GN:GW:GY:HT:HM:VA:HN:HK:HU:" &
"IS:IN:ID:IR:IQ:IE:IM:IL:IT:JM:JP:JE:JO:KZ:KE:KI:" &
"KP:KR:KW:KG:LA:LV:LB:LS:LR:LY:LI:LT:LU:MO:MK:" &
"MG:MW:MY:MV:ML:MT:MH:MQ:MR:MU:YT:MX:FM:MD:MC:" &
"MC:MN:ME:MS:MA:MZ:MM:MA:NR:NP:NL:AN:NC:NZ:NI:" &
"NE:NG:NU:NF:MP:NO:OM:PK:PW:PS:PA:PG:PY:PE:PH:" &
"PN:PL:PT:PR:QA:RE:RO:RU:RW:SH:KN:LC:PM:VC:WS:" &
"SM:ST:SA:SN:RS:SC:SL:SG:SK:SI:SB:SO:ZA:GS:ES:" &
"LK:SD:SR:SJ:SZ:SE:CH:SY:TW:TJ:TZ:TH:TL:TG:TK:" &
"TO:TT:TN:TR:TM:TC:TV:UG:UA:AE:GB:US:UM:UY:UZ:" &
"VU:VE:VN:VG:VI:WF:EH:YE:ZM:ZW",
BillingCountry)))
Error Message:
A valid two-letter country code is required.
Error Location:
Billing Country
Sample Account Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Account Number Is Numeric
Available in: both Salesforce
Classic and Lightning
Experience
Field
Value
Description:
Validates that the Account Number is numeric if not blank.
Formula:
AND(
ISBLANK(AccountNumber),
NOT(ISNUMBER(AccountNumber))
)
Error Message:
Account Number is not numeric.
Error Location:
Account Number
203
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Extend Salesforce with Clicks, Not Code
Customize Fields
Account Number Length
Field
Value
Description:
Validates that the Account Number is exactly seven digits (if it is not blank). The number
seven is simply illustrative. You can change this to any number you like.
Formula:
AND(
ISBLANK(AccountNumber),
LEN(AccountNumber) <> 7
)
Error Message:
Account Number must be seven digits.
Error Location:
Account Number
Annual Revenue Range
Field
Value
Description:
Validates that the account Annual Revenue is not negative and does not exceed $100
billion. This limit is designed to catch typos.
Formula:
OR(
AnnualRevenue < 0,
AnnualRevenue > 100000000000
)
Error Message:
Annual Revenue cannot exceed 100 billion.
Error Location:
Annual Revenue
Sample Call Center Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
204
Extend Salesforce with Clicks, Not Code
Customize Fields
Conditionally Require Description When Case Reason is “Other”
Field
Value
Description:
Validates that a custom field called Other Reason contains a value if a case has a Case
Reason of “Other.”
Formula:
AND(
ISPICKVAL( Reason, "Other" ),
ISBLANK(Other_Reason__c)
)
Error Message:
Description of Other Reason is required.
Error Location:
Other Reason
Prevent Open Cases from Being Reset to New
Field
Value
Description:
If a case is already open, prevents the Status from being changed back to “New.”
Formula:
AND(
ISCHANGED( Status ),
NOT(ISPICKVAL(PRIORVALUE( Status ), "New")),
ISPICKVAL( Status, "New")
)
Error Message:
Open case Status cannot be reset to New.
Error Location:
Status
Restrict Status of Re-Opened Cases
Field
Value
Description:
Validates that the case Status is “Re-opened” when a closed case is opened again.
Formula:
AND(
ISCHANGED( Status ),
OR(
ISPICKVAL(PRIORVALUE( Status ), "Closed"),
ISPICKVAL(PRIORVALUE( Status ),
"Closed in SSP")),
NOT( ISPICKVAL( Status, "Re-Opened"))
)
Error Message:
Closed case can only be changed to “Re-opened.”
Error Location:
Status
205
Extend Salesforce with Clicks, Not Code
Customize Fields
Prevent Case Milestone Completion After Cases Are Closed
Field
Value
Description:
Validates that a milestone's Completion Date can't occur after the case's Status is
Closed.
Formula:
Case.IsClosed
= true
Error Message:
You can't complete a milestone after a case is closed.
Error Location:
Top of Page
Prevent Case Milestone Completion Before Case Creation Dates
Field
Value
Description:
Validates that the milestone's Completion Date has occurred after the case's
Date/Time Opened.
Formula:
CompletionDate >=
Case.ClosedDate
Case.CreatedDate
&&
CompletionDate
<=
Error Message:
The milestone Completion Date must occur after the date the case was created and before the
case was closed.
Error Location:
Top of Page
Sample Community Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Preventing Offensive Language in Questions
Available in: both Salesforce
Classic and Lightning
Experience
Field
Value
Description:
Prevents users from entering offensive language in the Title and
Description fields when asking a question.
Formula:
Error Message:
OR(CONTAINS(Title, 'darn'), CONTAINS(Body,
'darn'))
Question title or description contains offensive language.
206
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Extend Salesforce with Clicks, Not Code
Customize Fields
Preventing Offensive Language in Replies
Field
Value
Description:
Prevents users from entering offensive language when replying to a question.
Formula:
Error Message:
OR(CONTAINS(Body, 'darn'), CONTAINS(Body, 'dang'))
Reply contains offensive language.
Preventing Offensive Language in Ideas
Field
Value
Description:
Prevents users from entering offensive language in the Title and Description fields
when posting an idea.
Formula:
Error Message:
OR(CONTAINS(Title, 'darn'), CONTAINS(Body, 'darn'))
Idea title or description contains offensive language.
Preventing Offensive Language in Idea Comments
Field
Value
Description:
Prevents users from entering offensive language when posting a comment.
Formula:
Error Message:
OR(CONTAINS(CommentBody , 'darn'), CONTAINS(CommentBody,
'dang'))
Comment contains offensive language.
Sample Contact Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
207
Extend Salesforce with Clicks, Not Code
Customize Fields
Mailing Address Fields Are Required
Field
Value
Description:
Validates that the contact Mailing Street, Mailing City, and Mailing
Country are provided.
Formula:
OR(
ISBLANK( MailingStreet ),
ISBLANK( MailingCity ),
ISBLANK( MailingCountry )
)
Error Message:
Mailing Street, City, and Country are required.
Error Location:
Top of Page
Mailing Street Is Required
Field
Value
Description:
Validates that the contact Mailing Street is provided.
Formula:
ISBLANK( MailingStreet )
Error Message:
Mailing Street is required.
Error Location:
Mailing Street
208
Extend Salesforce with Clicks, Not Code
Customize Fields
Mailing Zip Code
Field
Value
Description:
Validates that the contact Mailing Zip/Postal Code is in 99999 or 99999-9999 format if
Mailing Country is USA or blank.
Formula:
AND(
OR(MailingCountry = "USA", ISBLANK(MailingCountry)),
OR(
AND(LEN(MailingPostalCode) <>5,
LEN(MailingPostalCode) <> 10),
NOT(CONTAINS("0123456789",
LEFT( MailingPostalCode, 1))),
NOT(CONTAINS("0123456789",
MID( MailingPostalCode , 2, 1))),
NOT(CONTAINS("0123456789",
MID( MailingPostalCode , 3, 1))),
NOT(CONTAINS("0123456789",
MID( MailingPostalCode , 4, 1))),
NOT(CONTAINS("0123456789",
MID( MailingPostalCode , 5, 1))),
AND(
LEN(MailingPostalCode) = 10,
OR(
MID( MailingPostalCode , 6, 1) <> "-",
NOT(CONTAINS("0123456789",
MID( MailingPostalCode , 7, 1))),
NOT(CONTAINS("0123456789",
MID( MailingPostalCode , 8, 1))),
NOT(CONTAINS("0123456789",
MID( MailingPostalCode , 9, 1))),
NOT(CONTAINS("0123456789",
MID( MailingPostalCode , 10, 1)))
)
)
)
)
Note: This example interprets a blank country as US. To use this example with other countries,
remove the clause that checks the length of the country field. Also, validation rule criteria are
case sensitive, so this rule is only enforced when the country is blank or “USA” in all capital letters.
The rule is not enforced when the country is “usa.”
Tip: You can also validate zip codes using a regular expression; for an example of a formula
using a regular expression, see REGEX on page 297.
Error Message:
Zip code must be in 99999 or 99999-9999 format.
Error Location:
Mailing Zip/Postal Code
209
Extend Salesforce with Clicks, Not Code
Customize Fields
Phone Number Has International Format
Field
Value
Description:
Validates that the Phone number begins with a plus sign (+) for country code. Note that this
validation rule conflicts with the ten-digit rule.
Formula:
LEFT(Phone, 1) <> "+"
Error Message:
Phone number must begin with + (country code).
Error Location:
Phone
US Phone Number Has Ten Digits
Field
Value
Description:
Validates that the Phone number is in (999) 999-9999 format. This works by using the REGEX
function to check that the number has ten digits in the (999) 999-9999 format.
Formula:
NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}"))
Error Message:
US phone numbers should be in this format: (999) 999-9999.
Error Location:
Phone
Sample Cross Object Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Discounts Must Be Within Range
Available in: both Salesforce
Classic and Lightning
Experience
This example consists of three validation rules on opportunity products. The examples below work
together to help you manage discount amounts for products and require a custom percent field
on opportunity products called Line Discount. The examples below also require you to use
price books and customize the Product Family field to include the following values:
Software, Consulting, and Training.
Software Discounts
Field
Value
Description:
Prevents users from saving software products
with a discount over 10 percent.
Formula:
AND(Line_Discount__c > 0.10,
ISPICKVAL(Product2.Family,
"Software"))
210
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Extend Salesforce with Clicks, Not Code
Customize Fields
Field
Value
Error Message:
The discount must be 10% or less for software products.
Error Location:
Line Discount
Consulting Discounts
Field
Value
Description:
Prevents users from saving consulting products with a discount
over 15 percent.
Formula:
AND(Line_Discount__c > 0.15,
ISPICKVAL(Product2.Family, "Consulting"))
Error Message:
The discount must be 15% or less for consulting products.
Error Location:
Line Discount
Training Discounts
Field
Value
Description:
Prevents users from saving training products with a discount over
20 percent.
Formula:
AND(Line_Discount__c > 0.20,
ISPICKVAL(Product2.Family, "Training"))
Error Message:
The discount must be 20% or less for training products.
Error Location:
Line Discount
Prevent Changing Opportunity Products on Closed Opportunities
This example consists of two validation rules: one on opportunity products and another on opportunities.
Field
Value
Description:
Prevents users from editing opportunity products after an
opportunity is closed. Create the following validation rule example
on opportunity products.
Formula:
Error Message:
OR(ISPICKVAL(Opportunity.StageName, "Closed
Won"), ISPICKVAL(Opportunity.StageName,
"Closed Lost"))
Cannot change opportunity products for closed opportunities.
211
Extend Salesforce with Clicks, Not Code
Customize Fields
Field
Value
Error Location:
Top of Page
The following validation rule is on opportunities.
Field
Value
Description:
Prevents users from deleting opportunity products after an
opportunity is closed. Create the following validation rule example
on opportunities. It uses a custom roll-up summary field on
opportunities that counts the number of opportunity products on
an opportunity.
Formula:
AND(OR(ISPICKVAL(StageName, "Closed Won"),
ISPICKVAL(StageName, "Closed Lost")),
Number_of_Line_Items__c <
PRIORVALUE(Number_of_Line_Items__c) )
Error Message:
Cannot delete opportunity products for closed opportunities.
Error Location:
Top of Page
Prevent Saving a Case When Account Does Not Have Support
Field
Value
Description:
Prevents users from saving a case for an account that does not
have support. This example assumes you have a custom checkbox
field on accounts called Allowed Support that tracks if the
account has support.
Formula:
Account.Allowed_Support__c
= FALSE
Error Message:
Unable to create cases for this account because it is not signed up
for support.
Error Location:
Top of Page
Prevent Saving a Case When Contact is No Longer with the Company
Field
Value
Description:
Prevents users from saving an open case associated with a contact
that is no longer with the company. This example uses a custom
checkbox field on contacts called No Longer With
Company.
212
Extend Salesforce with Clicks, Not Code
Customize Fields
Field
Value
Formula:
AND(Contact.Not_Longer_With_Company__c,
NOT(IsClosed))
Error Message:
Unable to save this case because the related contact is no longer
with the company. To continue, choose another contact.
Error Location:
Contact Name
Sample Date Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Date Must Be a Weekday
Available in: both Salesforce
Classic and Lightning
Experience
Field
Value
Description:
Validates that the value of a custom date field is a weekday (not
Saturday or Sunday).
Formula:
CASE(MOD( My_Date__c - DATE(1900, 1, 7), 7),
0, 0,
6, 0,
1) = 0
Error Message:
Date must be a weekday.
Error Location:
My Date
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Date Must Be a Weekend Day
Field
Value
Description:
Validates that the value of a custom date field is a Saturday or Sunday.
Formula:
CASE( MOD( My_Date__c - DATE(1900, 1, 7), 7),
0, 1,
6, 1,
0) = 0
Error Message:
Date must be a weekend day.
Error Location:
My Date
213
Extend Salesforce with Clicks, Not Code
Customize Fields
Date Must Be in the Current Month
Field
Value
Description:
Validates that a custom date field contains a date within the current month and year.
Formula:
OR (
YEAR( My_Date__c ) <> YEAR ( TODAY() ),
MONTH( My_Date__c ) <> MONTH ( TODAY() )
)
Error Message:
Date must be in the current month.
Error Location:
My Date
Date Must Be in the Current Year
Field
Value
Description:
Validates that a custom date field contains a date within the current year.
Formula:
YEAR( My_Date__c ) <> YEAR ( TODAY() )
Error Message:
Date must be in the current year.
Error Location:
My Date
Date Must Be the Last Day of the Month
Field
Value
Description:
Validates whether a custom field called My Date is the last day of the month. To do this, it
determines the date of the first day of the next month and then subtracts 1 day. It includes
special case logic for December.
Formula:
DAY(My_Date__c) <>
IF(Month(My_Date__c)=12, 31,
DAY(DATE(YEAR(My_Date__c),MONTH(My_Date__c)+1,1) - 1))
Error Message:
Date must be the last day of the month.
Error Location:
My Date
214
Extend Salesforce with Clicks, Not Code
Customize Fields
Date Must Be Within One Year of Today
Field
Value
Description:
Validates whether a custom field called Follow-Up Date is within one year of today’s
date. This example assumes a 365 day year. (It does not handle leap years.)
Formula:
Followup_Date__c - TODAY() > 365
Error Message:
Follow-Up Date must be within one year of today.
Error Location:
Follow-Up Date
Day of Month Cannot Be Greater Than 15
Field
Value
Description:
Validates that a custom field called Begin Date contains a date in the first 15 days of the
specified month.
Formula:
DAY( Begin_Date__c ) > 15
Error Message:
Begin Date cannot be after the 15th day of month.
Error Location:
Begin Date
End Date Cannot Be Before Begin Date
Field
Value
Description:
Validates that a custom field called End Date does not come before another custom field
called Begin Date.
Formula:
Begin_Date__c > End_Date__c
Error Message:
End Date cannot be before Begin Date.
Error Location:
Begin Date
215
Extend Salesforce with Clicks, Not Code
Customize Fields
Expiration Date Cannot Be Before Close Date
Field
Value
Description:
Validates that a custom field called Expiration Date does not come before Close
Date.
Formula:
Expiration_Date__c < CloseDate
Error Message:
Expiration Date cannot be before Close Date.
Error Location:
Expiration Date
Sample Number Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Time Cards Must Total 40 Hours
Available in: both Salesforce
Classic and Lightning
Experience
Field
Value
Description:
Ensures that users cannot save a time card record with more than
40 hours in a work week. This example requires five custom fields on
your custom object, one for each day of work.
Formula:
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Monday_Hours__c +
Tuesday_Hours__c +
Wednesday_Hours__c +
Thursday_Hours__c +
Friday_Hours__c > 40
Error Message:
Your total hours cannot exceed 40.
Error Location:
Top of Page
Number Cannot Be Negative
Field
Value
Description:
Validates that a custom field called Hours Worked is not a negative number.
Formula:
Hours_Worked__c < 0
Error Message:
Hours Worked cannot be less than zero.
Error Location:
Hours Worked
216
Extend Salesforce with Clicks, Not Code
Customize Fields
Number Must Be Even
Field
Value
Description:
Validates that a custom field called Ark Passengers is a non-negative even number.
Formula:
OR(
Ark_Passengers__c < 0,
MOD( Ark_Passengers__c, 2) <> 0
)
Error Message:
Ark Passengers must be a positive even number.
Error Location:
Ark Passengers
Number Must Be Odd
Field
Value
Description:
Validates that a custom field called Socks Found is a non-negative odd number.
Formula:
OR(
Socks_Found__c < 0,
MOD( Socks_Found__c, 2) = 0
)
Error Message:
Socks Found must be an odd number.
Error Location:
Socks Found
Number Must Be a Multiple of Five
Field
Value
Description:
Validates that a custom field called Multiple of 5 is a multiple of five.
Formula:
MOD( Multiple_of_5__c, 5) <> 0
Error Message:
Number must be a multiple of five.
Error Location:
Multiple of 5
217
Extend Salesforce with Clicks, Not Code
Customize Fields
Number Must Be an Integer
Field
Value
Description:
Validates that a custom field called My Integer is an integer.
Formula:
FLOOR( My_Integer__c) <> My_Integer__c
Error Message:
This field must be an integer.
Error Location:
My Integer
Number Must Be Between -50 and 50
Field
Value
Description:
Validates that a custom field called Volume is between -50 and 50.
Formula:
ABS( Volume__c) > 50
Error Message:
Volume must be between -50 and 50.
Error Location:
Volume
Number Range Validation
Field
Value
Description:
Validates that the range between two custom fields, Salary Min and Salary Max, is
no greater than $20,000.
Formula:
(Salary_Max__c - Salary_Min__c) > 20000
Error Message:
Salary range must be within $20,000. Adjust the Salary Max or Salary Min values.
Error Location:
Salary Max
218
Extend Salesforce with Clicks, Not Code
Customize Fields
Percentage Must Be Between Zero and 100
Field
Value
Description:
Validates that a custom field called Mix Pct is between 0 and 100%. Note that percent fields
are expressed divided by 100 in formulas (100% is expressed as 1; 50% is expressed as 0.5).
Formula:
OR(
Mix_Pct__c > 1.0,
Mix_Pct__c < 0.0
)
Error Message:
Mix Pct must be between 0 and 100%.
Error Location:
Mix Pct
Sample Opportunity Management Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Conditionally-Required Field Based on Opportunity Stage
Available in: both Salesforce
Classic and Lightning
Experience
Field
Value
Description:
Validates that a custom field called Delivery Date is provided
if an opportunity has advanced to the Closed Won or
Negotiation/Review stage.
Formula:
AND (
OR (
ISPICKVAL(StageName, "Closed Won"),
ISPICKVAL(StageName,
"Negotiation/Review")),
ISBLANK(Delivery_Date__c)
)
Error Message:
Delivery Date is required for this stage.
Error Location:
Delivery Date
219
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Extend Salesforce with Clicks, Not Code
Customize Fields
Close Date Cannot Be Prior to Current Month
Field
Value
Description:
Validates that the Close Date of an opportunity is not within a month prior to the current
month. Note the use of ISNEW and ISCHANGED in this formula to ensure the condition is only
checked when the opportunity is being created or the Close Date field is modified
subsequently.
Formula:
AND(
OR (
ISNEW(),
ISCHANGED( CloseDate )),
CloseDate < DATE( YEAR(TODAY()), MONTH(TODAY()), 1) )
Error Message:
Close Date cannot be prior to current month.
Error Location:
Close Date
Close Date Must Be a Future Date
Field
Value
Description:
Ensures that users do not change the Close Date of an opportunity to a day in the past.
Formula:
SampleDate < TODAY()
Error Message:
Close Date cannot be a day in the past.
Error Location:
Close Date
Discounts on Opportunities
Field
Value
Description:
Validates that a custom discount percent field is between 0 and 40%.
Formula:
OR(Discount_Rate__c < 0, Discount_Rate__c > 0.40)
Error Message:
The Discount Rate must not exceed 40%.
Error Location:
Discount Rate
220
Extend Salesforce with Clicks, Not Code
Customize Fields
High-Value Opportunity Must Be Approved Before Closed
Field
Value
Description:
Opportunities with amounts greater than $50,000 require that a custom checkbox field called
Approved is checked in order to change the stage to Closed Won or Closed Lost. To automate
this, set field-level security on the Approved checkbox so that it can only be checked via a
custom approval process (Enterprise Edition, Unlimited Edition, or Performance Edition).
Formula:
AND(
OR(
ISPICKVAL(StageName,"Closed Won"),
ISPICKVAL(StageName,"Closed Lost")),
(Amount > 50000),
NOT(ISPICKVAL(Approval_Status__c ,"Approved")))
Error Message:
All high-value opportunities must be approved for closure. Click the Request Close button.
Error Location:
Top of Page
Opportunity Amount Cannot Exceed $10 Million
Field
Value
Description:
Validates that opportunity Amount is positive and no more than $10 million. This limit is
designed to catch typos.
Formula:
OR(
Amount < 0,
Amount > 10000000
)
Error Message:
Amount cannot exceed $10 million.
Error Location:
Amount
Opportunity Check for Products
Field
Value
Description:
Validates that an opportunity has at least one opportunity product before users can save a change to
an opportunity.
Formula:
NOT(OR(ISNEW(),HasOpportunityLineItem))
Error Message:
You must add products to this opportunity before saving.
Error Location:
Top of Page
221
Extend Salesforce with Clicks, Not Code
Customize Fields
Opportunity Must Have Products if Beyond “Needs Analysis” Stage
Field
Value
Description:
Validates that an opportunity has opportunity products before the Stage can move beyond
Needs Analysis.
Formula:
AND (
CASE( StageName,
"Value Proposition", 1,
"Id. Decision Makers", 1,
"Perception Analysis", 1,
"Proposal/Price Quote", 1,
"Negotiation/Review", 1,
"Closed Won", 1,
0) = 1,
NOT(HasOpportunityLineItem)
)
Error Message:
Opportunity products are required to advance beyond the Needs Analysis stage.
Error Location:
Top of Page
Opportunity Name Format
Field
Value
Description:
Validates that an opportunity contains a hyphen as a way of enforcing an “[Account] - [Amount]”
opportunity naming convention.
Formula:
FIND( " - ", Name ) = 0
Error Message:
Opportunity Name should use “[Account] - [Amount]” format.
Error Location:
Opportunity Name
222
Extend Salesforce with Clicks, Not Code
Customize Fields
Prevent Sales Reps from Moving Opportunity Stage Backwards
Field
Value
Description:
Prevent sales reps from changing opportunity Stage “backwards” to specific values, once
they have accepted the opportunity via a custom approval process. The approval process sets
the custom Accepted Flag checkbox to True.
Formula:
AND(
Accepted_Flag__c,
OR ( ISPICKVAL( StageName, "Stage 1"), ISPICKVAL( StageName,
"Stage 2"))
)
Error Message:
Invalid stage for accepted opportunity.
Error Location:
Stage
Probability Must Be 100% for Won Opportunities
Field
Value
Description:
Validates that the probability of a won opportunity is properly set to 100%. This is useful for
data cleanliness and reporting purposes.
Formula:
AND (
ISPICKVAL( StageName, "Closed Won"),
Probability <> 1)
Error Message:
Probability must be 100% for won opportunities.
Error Location:
Probability
Probability Must Be Zero for Lost Opportunities
Field
Value
Description:
Validates that the probability of a lost opportunity is properly set to zero. This is useful for data
cleanliness and reporting purposes.
Formula:
AND (
ISPICKVAL( StageName, "Closed Lost"),
Probability <> 0)
Error Message:
Probability must be 0% for lost opportunities.
Error Location:
Probability
223
Extend Salesforce with Clicks, Not Code
Customize Fields
Project Start Date
Field
Value
Description:
Validates that a field is conditionally required based on the values of other fields. Use this validation
formula to ensure that users include a Project Start Date for an opportunity that is
closed/won.
Formula:
AND(ISPICKVAL(StageName, "Closed Won"),
ISNULL(Project_Start_Date__c))
Error Message:
Project start date is required for won opportunities.
Error Location:
Project Start Date
Sample Quote Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Display Error if Quote Line Item Discount Exceeds 40%
Available in: both Salesforce
Classic and Lightning
Experience
Field
Value
Description:
Shows an error if a quote line item's discount exceeds 40%.
Formula:
Discount > .40
Error Message:
The discount on this quote line item cannot exceed 40%.
Error Location:
Discount on quote
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Sample User, Role, and Profile Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
224
Extend Salesforce with Clicks, Not Code
Customize Fields
Discount Percent Does Not Exceed Role-Based Limit
Field
Value
Description:
Validates that a custom field on opportunities called Discount Percent does not exceed
a maximum value that varies depending on the user’s role. The default maximum is 15%.
Formula:
Discount_Percent__c >
VLOOKUP($ObjectType.Role_Limits__c.Fields.Limit__c,
$ObjectType.Role_Limits__c.Fields.Name,
$UserRole.Name)
Error Message:
Discount (%) exceeds limit allowed for your role.
Error Location:
Discount Percent
Expense Amount Does Not Exceed User's Max Allowed Expense
Field
Value
Description:
Validates a custom field called Expense Amount against a custom user field called Max
Allowed Expense.
Formula:
Expense_Amount__c > $User.Max_Allowed_Expense__c
Error Message:
Amount cannot exceed your maximum allowed expense.
Error Location:
Expense Amount
Only Record Owner Can Change Field
Field
Value
Description:
Ensures that only the record owner can make changes to a custom field called Personal
Goal.
Formula:
AND(
ISCHANGED( Personal_Goal__c ),
Owner <> $User.Id
)
Error Message:
Only record owner can change Personal Goal.
Error Location:
Personal Goal
225
Extend Salesforce with Clicks, Not Code
Customize Fields
Only Record Owner or Administrator Can Change Field
Field
Value
Description:
Ensures that a user can make changes to a custom field called Personal Goal only if the
user is the record owner or has a custom profile of “Custom: System Admin.”
Formula:
AND( ISCHANGED( Personal_Goal__c ), Owner <> $User.Id,
$Profile.Name <>
"Custom: System Admin" )
Note: $Profile merge fields are only available in Enterprise, Unlimited, Performance,
and Developer Editions.
Error Message:
Only record owner or administrator can change Personal Goal.
Error Location:
Personal Goal
Opportunity Close Date Can Only Be Back-Dated by Administrator
Field
Value
Description:
Validates that the Close Date of an opportunity does not fall prior to the current month,
except for users who have a custom profile called “Custom: System Admin.”
Formula:
AND(
OR (
ISNEW(),
ISCHANGED( CloseDate )),
CloseDate < DATE( YEAR(TODAY()), MONTH(TODAY()), 1),
$Profile.Name <> "Custom: System Admin"
)
Note: $Profile merge fields are only available in Enterprise, Unlimited, Performance,
and Developer Editions.
Error Message:
Close Date cannot be prior to current month.
Error Location:
Close Date
226
Extend Salesforce with Clicks, Not Code
Customize Fields
Miscellaneous Sample Validation Rules
For more information on any of the formula functions used in these examples, see Formula Operators
and Functions on page 256.
EDITIONS
Allow Number to Be Increased but Not Decreased
Available in: both Salesforce
Classic and Lightning
Experience
Field
Value
Description:
Allows a custom field called Commit Amount to be increased
but not decreased after initial creation. This rule uses the
PRIORVALUE() function to compare the updated value of the field to
its value prior to update.
Formula:
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
PRIORVALUE(Commit_Amount__c) >
Commit_Amount__c
Error Message:
Commit Amount cannot be decreased.
Error Location:
Commit Amount
California Driver's License
Field
Value
Description:
Ensures that a custom field called Drivers License is in the correct A9999999 format
when the Mailing State is “CA”.
Formula:
AND(
MailingState = "CA",
NOT(REGEX(Drivers_License__c, "([A-Z]\\d{7})?"))
)
Error Message:
Invalid California driver's license format.
Error Location:
Drivers License
227
Extend Salesforce with Clicks, Not Code
Customize Fields
Force Users to Check “I Accept Terms” to Enter Certain Values
Field
Value
Description:
Uses a checkbox labeled “I accept terms” to force the user to select a checkbox in order to enter
a value called Number of Days that exceeds their Paid Time Off (PTO) balance available.
Formula:
AND(
NOT( I_accept_terms__c ),
Number_of_Days__c > $User.PTO_Balance__c
)
Error Message:
Request will cause a negative PTO balance. You must accept Negative PTO Balance terms.
Error Location:
I accept terms
Prohibit Changes to a Field After It Has Been Saved
Field
Value
Description:
Prevents users from changing a custom field called Guaranteed Rate after it has been
saved initially.
Formula:
AND(
NOT( ISNEW() ),
ISCHANGED( Guaranteed_Rate__c )
)
Error Message:
Guaranteed Rate cannot be changed.
Error Location:
Guaranteed Rate
228
Extend Salesforce with Clicks, Not Code
Customize Fields
Social Security Number Format
Field
Value
Description:
Validates that a custom text field called SSN is formatted in 999-99-9999 number format (if it
is not blank). The pattern specifies:
• Three single digits (0-9):\\d{3}
• A dash
• Two single digits (0-9):\\d{2}
• A dash
• Four single digits (0-9):\\d{4}
Formula:
NOT(
OR(
ISBLANK(Social_Security_Number__c),
REGEX( Social_Security_Number__c , "[0-9]{3}-[0-9]{2}-[0-9]{4}")
)
)
Error Message:
SSN must be in this format: 999-99-9999.
Error Location:
SSN
Valid Currency
Field
Value
Description:
Validates selected currency against an explicit subset of active currencies in your organization
using the Currency picklist. Use this example if you only allow some of the active currencies
in your organization to be applied to certain types of records.
Formula:
CASE(CurrencyIsoCode,
"USD", 1,
"EUR", 1,
"GBP", 1,
"JPY", 1,
0) = 0
Error Message:
Currency must be USD, EUR, GBP, or JPY.
Error Location:
Currency
229
Extend Salesforce with Clicks, Not Code
Customize Fields
Valid Credit Card Number
Field
Value
Description:
Validates that a custom text field called Credit_Card_Number is formatted in
9999-9999-9999-9999 or 9999999999999999 number format when it is not blank. The pattern
specifies:
• Four digits (0-9) followed by a dash: \\d{4}• The aforementioned pattern is repeated three times by wrapping it in () {3}
• Four digits (0-9)
• The OR character (|) allows an alternative pattern of 16 digits of zero through nine with no
dashes: \\d{16}
Formula:
NOT( REGEX( Credit_Card_Number__c ,
"(((\\d{4}-){3}\\d{4})|\\d{16})?"))
Error Message:
Credit Card Number must be in this format: 9999-9999-9999-9999 or 9999999999999999.
Error Location:
Credit Card Number
Valid IP Address
Field
Value
Description:
Ensures that a custom field called IP Address is in the correct format, four 3-digit numbers
(0-255) separated by periods.
Formula:
NOT(
REGEX( IP_Address__c,
"^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.)
{3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" ))
Error Message:
Error: IP Address must be in form 999.999.999.999 where each part is between 0 and 255.
Error Location:
IP Address
230
Extend Salesforce with Clicks, Not Code
Customize Fields
Website Extension
Field
Value
Description:
Validates a custom field called Web Site to ensure its last four characters are in an explicit
set of valid website extensions.
Formula:
AND(
RIGHT(
RIGHT(
RIGHT(
RIGHT(
RIGHT(
RIGHT(
RIGHT(
RIGHT(
)
Web_Site__c,
Web_Site__c,
Web_Site__c,
Web_Site__c,
Web_Site__c,
Web_Site__c,
Web_Site__c,
Web_Site__c,
4)
4)
4)
4)
4)
4)
6)
6)
<>
<>
<>
<>
<>
<>
<>
<>
".COM",
".com",
".ORG",
".org",
".NET",
".net",
".CO.UK",
".co.uk"
Error Message:
Web Site must have an extension of .com, .org, .net, or .co.uk.
Error Location:
Web Site
Require Field Input to Ensure Data Quality
Improve the quality of data that users enter in Salesforce by creating universally required fields.
A universally required field is a custom field. It must have a value whenever a record is saved within
Salesforce, the Force.com API, Connect Offline, Salesforce for Outlook, the Self-Service portal, or
automated processes such as Web-to-Lead and Web-to-Case. Making a field required on a page
layout or through field-level security ensures that users must enter a value. Making a field required
universally gives you a higher level of data quality beyond the presentation level of page layouts.
You can make the following types of custom fields universally required:
• Currency
• Date
• Date/Time
• Email
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
• Phone
Connect Offline,
Salesforce for Outlook, the
Self-Service portal,
Web-to-Lead, and
Web-to-Case are not
available in Database.com
• Picklist
.
• Master-Detail Relationship (always required)
• Number
• Percent
• Text
• Text Area
• URL
To make a custom field universally required, select the Required checkbox when defining the custom field.
231
Extend Salesforce with Clicks, Not Code
Customize Fields
Note: You must specify a default value for required campaign member custom fields.
If you make a user field universally required, you must specify a default value for that field.
Relationship group members do not support universally required fields.
Considerations for Universally Required Fields
Considerations for Universally Required Fields
A universally required field is a custom field. It must have a value whenever a record is saved within
Salesforce, the Force.com API, Connect Offline, Salesforce for Outlook, the Self-Service portal, or
automated processes such as Web-to-Lead and Web-to-Case. Review the following considerations
before making your custom fields universally required.
• Standard fields cannot be universally required.
• Universally required fields are required across all record types.
• Edit pages always display universally required fields, regardless of field-level security.
• When designing your page layouts, universally required fields:
– Cannot be removed from a page layout
– Are automatically added to the end of the first section of a page layout if not already on it
– Cannot be read only or optional
– Display in bold, indicating they are always visible
– Are disabled on the field properties page because you cannot remove the required setting
• Universally required fields are only enforced during lead conversion if validation and triggers
for lead conversion are enabled in your organization.
• Quick Create does not enforce universally required fields.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Standard Objects, Page
Layouts, Connect Offline,
Salesforce for Outlook, the
Self-Service portal,
Web-to-Lead, and
Web-to-Cases are not
available in Database.com
• If you make an activity custom field universally required, you must also provide a default value.
• You must include universally required fields in your import files or the import will fail.
• Don’t assign default values to fields that are both required and unique, because uniqueness errors can result.
• You cannot make a field universally required if it is used by a field update that sets the field to a blank value.
• Required fields may be blank on records that existed before making the field required. When a user updates a record with a blank
required field, the user must enter a value in the required field before saving the record.
• Web-to-Lead and Web-to-Case request data is not validated by Salesforce. Invalid data isn’t saved when requests are submitted. For
example, if your custom field is a currency field and a user enters alphabetic characters such as “Abc” instead of numbers, the request
is still submitted but with no value saved in the custom currency field.
SEE ALSO:
Require Field Input to Ensure Data Quality
232
Extend Salesforce with Clicks, Not Code
Customize Fields
About Field Sets
A field set is a grouping of fields. For example, you could have a field set that contains fields describing
a user's first name, middle name, last name, and business title. When a field set is added to a
Visualforce page, developers can loop over its fields and render them. If the page is added to a
managed package, administrators can add, remove, or reorder fields in a field set to modify the
fields presented on the Visualforce page without modifying any code. The same Visualforce page
can present different sets of information, depending on which fields a subscriber prefers to keep.
As an administrator, you can create or edit field sets for your organization, or edit any installed field
set. Field sets are available on all standard objects that support custom fields, and any organization
that supports creating Visualforce pages.
EDITIONS
Available in: Salesforce
Classic
Available in: Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Fields added to a field set can be in one of two categories:
• If a field is marked as Available for the Field Set, it exists in the field set, but the developer hasn’t presented it on
the packaged Visualforce page. Administrators can display the field after the field set is deployed by moving it from the Available
column to the In the Field Set column.
• If a field is marked as In the Field Set, the developer has rendered the field on the packaged Visualforce page by default.
Administrators can remove the field from the page after the field set is deployed by removing it from the In the Field Set
column.
Creating and Editing Field Sets
Field Sets Required Bit
SEE ALSO:
Create Custom Fields
Developer's Guide: Visualforce Developer's Guide
ISVforce Guide
Creating and Editing Field Sets
Salesforce has a drag-and-drop WYSIWYG tool for creating and editing field sets The enhanced
field sets editor is enabled by default, and provides all of the functionality of the original editor, as
well as additional functionality and an easier-to-use WYSIWYG interface.
1. From the management settings for the appropriate object, go to Field Sets, and then click New.
2. Enter a Field Set Label. This is the name presented to subscribers who install the field through
a managed package.
3. Optionally, enter a name for your field set. This is used by your Visualforce page to reference
the field set.
EDITIONS
Available in: Salesforce
Classic
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
4. In the Where is this used? area, provide a brief description of which Visualforce pages use the
field set, and for what purpose. This information helps a subscriber understand where and how
an installed field set is being used, so that they can populate it with their own fields.
5. Save your changes.
6. To add fields to the field set, drag the fields from the object palette and drop them into the Available for the Field
Set or the In the Field Set container. The fields in the Available for the Field Set container are not
initially visible on the Visualforce page. The fields in the In the Field Set container are visible by default.
233
Extend Salesforce with Clicks, Not Code
Customize Fields
Note: In the field set, you can span to fields that reference multiple objects. When you span a field into a field set that references
multiple objects, the only field you can span to is the Name object.
You can drag and drop a field from one container to the other. The vertical order of the In the Field Set list indicates the
order of how the fields render on Visualforce pages.
7. To remove a field from the field set, drag the element back to the object palette, or click the
8. To make a field required, double click the element or click the wrench icon (
Note:
icon next to the element.
) next to it and select the Required checkbox.
Indicates the field is required and must have a value to save the record.
9. Save your changes.
Important: The total number of cross object spans within the In the Field Set container can't exceed 25.
After a field set is deployed in your organization, you can always mark fields that are in the Available for the Field Set
list as In the Field Set, or vice versa. To do so:
1. Find the field set that you want to edit. From Setup enter Installed Packages in the Quick Find box, select Installed
Packages, click an installed package, and then click the field set you want to edit. Alternatively, if you know which object contains
the field set you want to edit, go to the object detail page and click Edit in the field set related list.
2. If you didn't create the field set initially, you'll only be able to edit the fields within the field set. To move fields between containers,
drag and drop a field from one container to the other. To change the order of a rendered field, drag a field up or down the list and
drop the field in the order you want it to appear.
3. Save your changes.
SEE ALSO:
About Field Sets
Field Sets Required Bit
You can define a field as required when you create or edit field sets. You may want to define a field
as required to ensure a user enters the necessary information on a field. The required field is only
available in the In the Field Set container. If you define a field as required in the In
the Field Set container, and remove the field from the In the Field Set, the
required attribute is removed.
Note: If you remove fields that were made required by an installed managed package from
the In the Field Set container, the required attribute isn’t removed from those
fields.
To define a field as required in a field set, see Creating and Editing Field Sets on page 233
SEE ALSO:
About Field Sets
234
EDITIONS
Available in: Salesforce
Classic
Available in: Group,
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Extend Salesforce with Clicks, Not Code
Customize Fields
Roll-Up Summary Field
A roll-up summary field calculates values from related records, such as those in a related list. You
can create a roll-up summary field to display a value in a master record based on the values of fields
in a detail record. The detail record must be related to the master through a master-detail relationship.
For example, you want to display the sum of invoice amounts for all related invoice custom object
records in an account’s Invoices related list. You can display this total in a custom account field
called Total Invoice Amount.
You can perform different types of calculations with a roll-up summary field. You can count the
number of detail records related to a master record. Or, you can calculate the sum, minimum value,
or maximum value of a field in the detail records.
Before you begin creating roll-up summary fields for your organization, review the implementation
tips and best practices.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Implementation Tips
Administration
• Create roll-up summary fields on:
– Any custom object that is on the master side of a master-detail relationship
– Any standard object that is on the master side of a master-detail relationship with a custom object
– Opportunities using the values of opportunity products related to the opportunity
– Accounts using the values of related opportunities
– Campaigns using campaign member status or the values of campaign member custom fields
Note: Campaign member custom formula fields that reference fields derived from leads or contacts are not supported.
• The types of fields you can calculate in a roll-up summary field depend on the type of calculation. For example,
– Number, currency, and percent fields are available when you select SUM as the roll-up type.
– Number, currency, percent, date, and date/time fields are available when you select MIN or MAX as the roll-up type.
• Sometimes you can’t change the field type of a field that you reference in a roll-up summary field.
• Make sure that the filter for your roll-up summary doesn't encounter a formula field that results in “#Error!”. If one of your filter criteria
uses a formula field that results in an error, no matches are returned for that filter criterion. For example, your roll-up summary filter
is “Formula Field equals 10”. Two records contain errors, and one contains the value “10” in that field. In this case, your summary
includes only the record with the value “10.”
• When you delete a child record on a roll-up Summary field, Salesforce doesn’t recalculate the value of the field. Select the Force
a mass recalculation on this field option on the edit page of the roll-up summary field to manually recalculate
the value.
• You can’t use long text area, multi-select picklist, Description fields, system fields like Last Activity, cross-object formula
fields, and lookup fields in the field column of roll-up summary filters.
• Auto number fields are not available as the field to aggregate in a roll-up summary field.
• After you have created a roll-up summary field on an object, you cannot convert the object's master-detail relationship into a lookup
relationship.
• Roll-up summary fields are not available for mapping lead fields of converted leads.
Management
235
Extend Salesforce with Clicks, Not Code
Customize Fields
• If a roll-up summary field doesn’t contain cross-object field references or functions that derive values on the fly, such as NOW or
TODAY, it can calculate the values of formula fields.
Note: The value of a formula field can result in “#Error!”, which affects the summarized total. If your roll-up summary type is
COUNT, records are included regardless of whether they contain a formula field with an error. However, when the Field
to Aggregate is a formula field that results in “#Error!”, calculations of type MIN, MAX, and SUM exclude those formula
values.
• Changes to the value of a roll-up summary field can trigger assignment rules to run. If a roll-up summary field is part of the criteria
in an assignment rule, the field’s new value is used to evaluate whether to reassign the record.
• A roll-up summary field can trigger workflow rules and field validations. However, workflow rules and field validations do not fire
when the following changes cause a mass recalculation of roll-up summary values:
– Changing the roll-up summary definition (such as the object, function, or field being aggregated)
– Changing the expression of a formula field referenced in a roll-up summary field
– Replacing picklist values for picklist fields referenced in the roll-up summary filter
– Changing picklist record type definitions
– Changing currency conversion rates
– Changing price book entries
• Calculating roll-up summary field values can take up to 30 minutes, depending on the number of records affected and other factors.
• You aren’t prevented from creating roll-up summary fields that can result in invalid values, such as February 29 in a non-leap year.
If a roll-up summary field results in an invalid value, the value is not recalculated. The field continues to display with an invalid roll-up
summary icon ( ) until you change the values being summarized.
• If your organization uses multiple currencies, the currency of the master record determines the currency of the roll-up summary
field. For example, if the master and detail records are in different currencies, the detail record value is converted into the currency
of the master record.
• Changing a conversion rate triggers roll-up summary fields to recalculate. If you’re using multiple currencies, we recommend changing
the conversion rate from Manage Currencies in Setup, and not from the API. If you change the rate from the API, related jobs that
are less than 24 hours old can interfere with your change. For details, see Edit Conversion Rates.
• If your organization has advanced currency management enabled, currency roll-up summary fields are invalid if they are on accounts
and summarizing opportunity values, or on opportunities and summarizing custom object values.
• Salesforce prevents users from saving a record if it invalidates a related record. For example, a master record has a validation rule
that requires the roll-up summary field value to be greater than 100. If the user’s change to a related child record would put the
value over 100, the user can’t save the record.
• If a lookup field references a record that has been deleted, Salesforce clears the value of the lookup field by default. Alternatively,
you can choose to prevent records from being deleted if they’re in a lookup relationship.
To be used in a roll-up summary field with a Roll-Up Type of COUNT or SUM, the lookup field must have the What to
do if the lookup record is deleted? option set to Don’t allow deletion of the lookup record
that’s part of a lookup relationship. If the option Clear the value of this field. You
can’t choose this option if you make the field required is selected, you can’t create a COUNT or
SUM roll-up summary field that pulls data from your lookup field.
Best Practices
• Apply field-level security to your roll-up summary fields if they calculate values that you do not want visible to users. Fields that your
users cannot see due to field-level security settings on the detail record are still calculated in a roll-up summary field.
236
Extend Salesforce with Clicks, Not Code
Customize Fields
• If you have validation rules, consider how they affect roll-up summary fields. The value in a roll-up summary field changes when the
values in the detail records change. So, validation errors can display when saving either the detail or master record.
• Because roll-up summary fields are not displayed on edit pages, you can use them in validation rules but not as the error location
for your validation.
• Avoid referencing a roll-up summary field from a child record. The roll-up summary fields referenced from child records can have
outdated values, because their parent records have not been updated. Instead, reference roll-up summary fields from parent records.
Your roll-up summary fields will always have updated values, because that rule runs after the parent value has been updated.
If you’re trying to enforce a record limit of 25 on the parent roll-up summary field, create validation rules on your child objects. When
you add a child record, your validation rule on the child object can check if the count is already 25 or greater.
AND(ISNEW(), Sample.Line_Count__c >= 25)
• Plan your implementation of roll-up summary fields carefully before creating them. Once created, you cannot change the detail
object selected or delete any field referenced in your roll-up summary definition.
• Advanced currency management affects roll-up summary fields. If your organization enables advanced currency management,
delete the currency roll-up summary fields on accounts that summarize opportunity values and on opportunities that summarize
custom object values. Otherwise, the fields continue to display with an invalid roll-up summary icon because their values are no
longer calculated.
• Automatically derived fields, such as current date or current user, aren’t allowed in a roll-up summary field. Forbidden fields include
formula fields containing functions that derive values on the fly, such as DATEVALUE, NOW, and TODAY. Formula fields that include
related object merge fields are also not allowed in roll-up summary fields.
• When you refer to a roll-up summary field in a list view or report, you can’t use certain qualifiers, including:
– Starts with
– Contains
– Does not contain
– Includes
– Excludes
– Within
Defining Roll-Up Summaries
SEE ALSO:
Create Custom Fields
Custom Fields Allowed Per Object
237
Extend Salesforce with Clicks, Not Code
Customize Fields
Defining Roll-Up Summaries
Define roll-up summary fields on the object that is on the master side of a master-detail relationship.
If a relationship does not already exist, first create a master-detail relationship between the master
object that displays the value and the detail object containing the records you are summarizing.
To define a roll-up summary field:
1. Create a custom field on the object where you want the field displayed. Summary fields
summarize the values from records on a related object, so the object on which you create the
field should be on the master side of a master-detail relationship. For instructions on creating
a custom field, see Create Custom Fields on page 133.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
3. Enter a field label and any other attributes. Click Next.
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
4. Select the object on the detail side of a master-detail relationship. This object contains the
records you want to summarize.
USER PERMISSIONS
2. Choose the Roll-Up Summary field type, and click Next.
5. Select the type of summary:
Type
Description
COUNT
Totals the number of related records.
To view roll-up summary
field definitions:
• View Setup and
Configuration
SUM
Totals the values in the field you select in the Field to Aggregate
option. Only number, currency, and percent fields are available.
To edit roll-up summary field
definitions:
• Customize Application
MIN
Displays the lowest value of the field you select in the Field to
Aggregate option for all directly related records. Only number, currency,
percent, date, and date/time fields are available.
MAX
Displays the highest value of the field you select in the Field to
Aggregate option for all directly related records. Only number, currency,
percent, date, and date/time fields are available.
6. Enter your filter criteria if you want a selected group of records in your summary calculation. If your organization uses multiple
languages, enter filter values in your organization's default language.
When you use picklists to specify filter criteria, the selected values are stored in the organization's default language. If you edit or
clone existing filter criteria, first set the Default Language on the Company Information page to the same language that was
used to set the original filter criteria. Otherwise, the filter criteria may not be evaluated as expected.
7. Click Next.
8. Set the field-level security to determine whether the field should be visible for specific profiles, and click Next.
9. Choose the page layouts that should display the field. The field is added as the last field in the first two-column section on the page
layout. For user custom fields, the field is automatically added to the bottom of the user detail page.
10. Click Save to finish or Save & New to create more custom fields.
SEE ALSO:
Roll-Up Summary Field
238
Extend Salesforce with Clicks, Not Code
Customize Fields
Lookup Filters
Improve user productivity and data quality with lookup filters. Lookup filters are administrator
settings that restrict the valid values and lookup dialog results for lookup, master-detail, and
hierarchical relationship fields.
Administrators specify the restrictions by configuring filter criteria that compare fields and values
on:
• The current record (source)
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
except for Database.com.
• The lookup object (target)
• The user's record, permissions, and role
• Records directly related to the target object
USER PERMISSIONS
For example, you can:
To manage lookup filters:
• Customize Application
• Restrict the Account Name field on opportunities to allow only accounts with a record type
of Customer, filtering out Partner and Competitor.
• Restrict the Account Name field on opportunities to allow only active accounts.
• Restrict the Contact field on cases to allow only contacts associated with the account specified in the Account Name field
on the case record.
• Restrict the Account Name field on cases to allow only users with the “International Sales” profile to create or edit cases for
accounts outside the United States.
Tip: When you define a lookup filter, optionally click Insert Suggested Criteria to choose from a list of lookup filter
criteria that Salesforce suggests based on the relationships between objects in your org.
Administrators can make lookup filters required or optional.
• For fields with required lookup filters, only values that match the lookup filter criteria appear in the lookup dialog. Also, users can't
save invalid values manually typed in the field when editing the record. If a user tries to save an invalid value, Salesforce displays an
error message, which administrators can customize.
• For fields with optional lookup filters, only values that match the lookup filter criteria appear in the lookup dialog initially; however,
users can click the Show all results link in the lookup dialog to remove the filter and view all search result values for the lookup
field. Also, optional lookup filters allow users to save values that don't match the lookup filter criteria, and Salesforce does not display
an error message if a user tries to save such values.
Lookup filter criteria can compare fields on the source object with different types of fields on the target object as long as the fields are
compatible.
Source Object Field Type
Compatible Target Object Field Types
Currency
Currency, Roll-Up Summary
Date
Date, Date/Time, Roll-Up Summary
Date/Time
Date, Date/Time, Roll-Up Summary
Hierarchy
Hierarchy, Lookup, Master-Detail
Lookup
Hierarchy, Lookup, Master-Detail
Master-Detail
Lookup, Hierarchy, Master-Detail
Number
Number, Percent, Roll-Up Summary
239
Extend Salesforce with Clicks, Not Code
Customize Fields
Percent
Number, Percent, Roll-Up Summary
Picklist
Text, Text Area, Email, URL
Roll-Up Summary
Currency, Number, Date, Date/Time, Roll-Up Summary
Supported Objects
Salesforce supports lookup filters on relationship fields that point to:
• Accounts
• Assets
• Badges
• Badges Received
• Business Hours
• Campaigns
• Cases
• Contacts
• Content Folders
• Contracts
• Endorsements
• Entitlements
• Ideas
• Leads
• Opportunities
• Order Products
• Orders
• Products
• Quotes
• Service contracts
• Skill Users
• Skills
• Social Personas
• Solutions
• Thanks
• User Provisioning Accounts
• User Provisioning Logs
• User Provisioning Requests
• Users
• Work Order Line Items
• Work Orders
• Zones
240
Extend Salesforce with Clicks, Not Code
Customize Fields
• Custom objects
Define Lookup Filters
Delete or Deactivate Lookup Filters
View a List of Lookup Filters for a Target Object
Dependent Lookups
Considerations for Lookup Filters
Notes on Using Lookup Filters with Person Accounts
Lookup Filters Best Practices
Lookup Filter Examples
Define Lookup Filters
1. You can create lookup filters for new relationship fields in step 3 of the custom field wizard.
EDITIONS
a. From the management settings for the field’s object, go to Fields.
b. Click Edit next to the name of the lookup or master-detail relationship field to which you
want to apply the filter.
2. In the Lookup Filter Options section, click Show Filter Settings.
3. Specify the filter criteria a record must meet to be a valid value. To specify criteria, click Insert
Suggested Criteria and choose from a list of suggested criteria, or manually enter your own
criteria. To enter your own criteria:
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
except for Database.com.
USER PERMISSIONS
a. In the first column, click the lookup icon or start typing in the text box and select a field.
To define lookup filters:
• Customize Application
b. In the second column, select an operator.
c. In the third column, select Value if Salesforce should compare the field in the first column
with a static value, or select Field if Salesforce should compare the field in the first
column with the value of another field.
d. In the fourth column, enter the value or select the field that Salesforce should compare with the field in the first column.
Note:
• Click Add Filter Logic to add Boolean conditions.
• Select a suggested field from the Field text box. You can only select fields on the current record, the lookup object, or the
user record. You can also choose related fields that are one relationship away from the lookup object. Salesforce assists
you by listing the available fields and relationships when you click the lookup icon or click inside the text box.
• Lookup filter criteria can compare fields of different types as long as they are compatible.
4. Specify whether the filter is required or optional. For fields with optional lookup filters, only values that match the lookup filter criteria
appear in the lookup dialog initially; however, users can click the Show all results link in the lookup dialog to remove the filter and
view all search result values for the lookup field. Also, optional lookup filters allow users to save values that don't match the lookup
filter criteria, and Salesforce does not display an error message if a user tries to save such values.
Note: In Lightning Experience, all filters are required, even if admins specify them as optional in Setup. There’s no Show all
results view.
241
Extend Salesforce with Clicks, Not Code
Customize Fields
For required lookup filters, specify whether you want Salesforce to display the standard error message or a custom message when
a user enters an invalid value.
5. Optionally, enter text to display in the lookup search dialog. Consider text that guides users in their searches and explains the business
rule that the lookup filter implements.
6. Leave Enable this filter selected.
7. Save your changes.
SEE ALSO:
Considerations for Lookup Filters
Dependent Lookups
Lookup Filter Examples
Find Object Management Settings
Delete or Deactivate Lookup Filters
1. From the managements settings for the relationship field’s object, go to Fields.
EDITIONS
2. Scroll to the Custom Fields & Relationships related list.
Available in: both Salesforce
Classic and Lightning
Experience
3. Click the name of the field containing the lookup filter.
4. Click Edit.
5. To deactivate the lookup filter, deselect Enable this filter, then save your changes.
Deactivating a lookup filter preserves the lookup filter configuration but:
Available in: All Editions
except for Database.com.
• Prevents it from applying to the relationship field
• Prevents it from impacting the cross-object references limit
• Removes it as a dependency for fields referenced in the lookup filter criteria
6. To delete the lookup filter, click Clear Filter Criteria, then save your changes.
Deleting a lookup filter permanently removes it. You can’t recover deleted lookup filters.
SEE ALSO:
Dependent Lookups
Considerations for Lookup Filters
Find Object Management Settings
242
USER PERMISSIONS
To define lookup filters:
• Customize Application
Extend Salesforce with Clicks, Not Code
Customize Fields
View a List of Lookup Filters for a Target Object
You can quickly see a list of all of the lookup filters that restrict the values of each target object. This
is useful when creating similar filters for a target object. Also, lookup filters that reference fields on
related objects count against the cross-object reference limit, which is the number of unique
relationships allowed for a target object. The Related Lookup Filters list lets you see which lookup
filters might impact that limit.
To see which lookup filters affect the limit for a particular target object, from the management
settings for the object, go to Related Lookup Filters.
SEE ALSO:
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
except for Database.com.
USER PERMISSIONS
Dependent Lookups
To define lookup filters:
• Customize Application
Considerations for Lookup Filters
Dependent Lookups
A dependent lookup is a relationship field with a lookup filter that references fields on the source
object. For example, you can configure the case Contact field to only show contacts associated
with the account selected in the case Account Name field.
When a user changes the value of a referenced field on the source object, Salesforce immediately
verifies that the value in the dependent lookup still meets the lookup filter criteria. If the value
doesn't meet the criteria, an error message is displayed and users can't save the record until the
value is valid.
If the referenced field on the source object is a lookup, master-detail, or hierarchy field, users can't
change its value by typing. Instead, users must click the lookup icon and select a value in the lookup
search dialog.
Tip: Dependent lookups are supported in Visualforce pages.
SEE ALSO:
Define Lookup Filters
Lookup Filter Examples
243
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To manage dependent
lookups:
• Customize Application
Extend Salesforce with Clicks, Not Code
Customize Fields
Considerations for Lookup Filters
• On the Fields page, the
icon indicates all fields with active lookup filters. The
indicates that the lookup filter is required.
icon
• The lookup filters you create in Salesforce also appear in the partner portal and Customer Portal.
• Lookup filters are case-sensitive.
• If you convert a required lookup filter with a custom error message to be optional, Salesforce
deletes the message.
• If you create a lookup filter that invalidates an existing value for that field, the value persists.
However, when a user edits the record, Salesforce displays an error message and requires the
user to change the invalid value before saving.
• You can’t save changes that cause required lookup filters on related records to contain invalid
values.
• Versions 16.0 and higher of the Salesforce API support lookup filters. Lookup filters are enforced
when you load data through the API.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
except for Database.com.
USER PERMISSIONS
To manage lookup filters:
• Customize Application
• If you configure a lookup filter to show inactive users only, the relationship field has no valid options. Inactive users are never valid
for relationship fields that point to the User object.
• If you create a filtered lookup on a field that looks up to another object, both objects must be deployed into the organization at the
same time.
• Lookup field filters don’t work if the field criteria include a master-detail relationship field.
• Salesforce doesn’t display an error message if the value of a controlling field invalidates the value of a dependent master-detail
relationship field.
• Dependent lookups are supported in Visualforce pages.
• In Lightning Experience, a lookup filter doesn’t work if a field referenced in the filtered lookup isn't added to the page layout.
Spanning Relationships in Lookup Filters
Filter criteria can include fields directly related to the target object (one level only). For example, on a lookup field pointing to contacts,
a lookup filter can reference fields on the account related to the contact via the Account Name relationship field. The lookup field can
also reference fields on the contact related to the contact via the Reports To relationship field.
For required lookup filters, each field referenced on a related lookup object counts against the number of unique relationships allowed
for the referenced object, not the source object. For example, the two unique relationships described above count against the number
allowed for the Contact object. Optional lookup filters don't count against the limit on the number of unique relationships allowed per
object.
To see which lookup filters affect the limit for a particular target object, from the management settings for the object, go to Related
Lookup Filters.
Lookup Filters vs. Validation Rules
Validation rules and lookup filters achieve similar ends, but offer different advantages. Use a lookup filter if:
• You want to improve user efficiency by limiting the number of available options in a lookup search dialog.
• You want to improve user efficiency by automating filters on lookup search dialogs that your users manually set.
Use a validation rule if:
• You're close to the maximum number of lookup filters allowed.
244
Extend Salesforce with Clicks, Not Code
Customize Fields
• You must implement a complex business rule that requires you to use a formula. Formulas can reference fields that basic filter criteria
can't reference, such as fields on the parent of the source object. Formulas can also use functions. For example, use ISNEW if the
rule should only apply on record creation, or ISCHANGED if the rule should apply when a field changes.
SEE ALSO:
Lookup Filters
Dependent Lookups
Notes on Using Lookup Filters with Person Accounts
If your organization uses person accounts, note the following:
EDITIONS
• Person Accounts don't support Contact filters; however, Person Accounts support Account
filters. For example, if the Account field has a dependent lookup filter that's added to a Person
Account, dependent lookups are supported. If the Contact field has a dependent lookup
filter that's added to a Person Account, dependent lookups isn't supported.
Available in: both Salesforce
Classic and Lightning
Experience
• Lookup filter criteria on Account Name only apply to business accounts, not person accounts.
Available in: All Editions
For example, if your lookup filter criteria is Account Name does not contain book,
except for Database.com.
business accounts with “book” in the name, such as John’s Bookstore, are not valid, but person
accounts with “book” in the name, such as John Booker, are valid and appear in the lookup
dialog for the Account field. If you need to filter on the name for a person account, use the First Name or Last Name
fields instead.
• Use the Is Person Account field in your lookup filter criteria to restrict the valid values of a lookup field to one type of account
(either person accounts or business accounts). For example, to restrict a lookup to only person accounts, include the following in
your lookup filter criteria: Is Person Account equals True.
• You can't package lookup filters that reference standard fields specific to person accounts, such as the Email and Title fields.
SEE ALSO:
Lookup Filters
Lookup Filters Best Practices
Custom Help
Define custom help for fields with lookup filters to let users know about the business rule the
filter enforces. For example, if the lookup filter restricts the Account Name on opportunities
to only allow active accounts, define custom help that states You can only associate
active accounts with opportunities.
Error Messages
Customize lookup filter error messages to guide users who type invalid values. For example, if
the lookup filter restricts the Account Name on opportunities to only allow active accounts,
define an error message that states Value doesn't exist or isn't an active
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
except for Database.com.
account.
Important: Salesforce translates the standard error message for required lookup filters, but not custom error messages. Use
the Translation Workbench to translate lookup filter custom error messages. To restore the standard error message after
modifying it, click Reset to default message.
245
Extend Salesforce with Clicks, Not Code
Customize Fields
Working with Master-Detail Relationship Fields
When creating a lookup filter on a master-detail relationship field, verify that the current values of the field on all of the detail records
meet the criteria you specify. If you specify criteria that an existing value doesn't meet, Salesforce prevents the user from saving
changes to the detail record. If this occurs, the user must first modify the value on the master record to meet the criteria. For example,
consider a custom object with a master-detail relationship field that points to accounts. If you define a lookup filter that excludes all
accounts with a Create Date before 01/01/2009, verify that no existing records of that custom object have a master-detail
relationship with any account created before 2009. A quick way to do this is to create a report that shows all accounts with a Create
Date before 01/01/2009.
Profile-Based Lookup Filters
Use Current User Profile: ID in filter criteria to define different filter criteria for different users, or to let administrators
enter values that don't match the criteria. Avoid using Current User Profile: Name due to technical limitations on
standard profiles.
If you enter Current User Profile: Name or Profile: Name in the Field column of your lookup filter criteria,
Salesforce displays a lookup icon in that row. Click the lookup icon to select from a list of existing profiles rather than typing profile
names.
Record IDs vs. Record Names
To reference a specific record in filter criteria, use the ID of the record instead of its name. IDs are always unique whereas names are
not.
Testing
After creating a lookup filter, test it to make sure it is not too restrictive. Depending on their permissions, some users may have
read-only access to some relationship fields; ensure your lookup filters don't prevent those users from editing records critical to their
job functions.
Dependent Lookups on Page Layouts and Mini Page Layouts in the Console
When designing page layouts with dependent lookups:
• If a dependent lookup is above its controlling field on a layout, make its lookup filter optional or redesign the layout. Moving a
required dependent lookup above its controlling field may confuse users who typically start from the top of a page when entering
data.
• Ensure that both the controlling and dependent fields are visible so users can correct invalid values.
Lookup Filters and the Lookup Filter Fields Search Layout
Don’t reference the same fields in both lookup filter criteria and the Lookup Filter Fields search layout. Users might assume that
results from their custom search override administrator-controlled lookup filters.
SEE ALSO:
Lookup Filters
246
Extend Salesforce with Clicks, Not Code
Customize Fields
Lookup Filter Examples
EDITIONS
Record Types in Lookup Filters
If the value of a relationship field should only consist of records with a particular record type, specify
the record type in a lookup filter. For example, if the Account Name field on opportunities
should only have accounts with a Customer Account custom record type, define the following
lookup filter to restrict users to only creating or editing opportunities associated with accounts that
have a Customer Account record type, excluding accounts with Partner Account and Competitor
Account record types:
Filter Criteria
Account Name: Account Record Type equals value Customer
Account
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
except for Database.com.
Record types available in:
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Custom Error Message
Account does not exist or is not a customer account.
Lookup Window Text
You can only associate customer accounts to an opportunity.
Search results only display customer accounts.
USER PERMISSIONS
To define lookup filters:
• Customize Application
Record Status in Lookup Filters
If the value of a relationship field should only consist of records with particular status, specify the status in a lookup filter. For example,
consider a Job Application object with a relationship field that points to the Position object. If the relationship field should only
have open positions, define the following lookup filter to restrict users to only creating or editing job applications for positions with the
Status field set to Open:
Filter Criteria
Position: Status equals value Open
Custom Error Message
Position does not exist or is not an open position.
Lookup Window Text
You can associate only open positions with job applications. Search results display
open positions only.
Profiles in Lookup Filters
When a business rule does not apply to users with every profile, use the Current User Profile global variable fields to define
lookup filters that only affect users with a particular profile.
For example, the following lookup filter on the Case object Account Name field restricts users with a “Domestic Sales” profile to only
creating or editing opportunities associated with accounts that have a billing country of “USA” while allowing other users to associate
opportunities with any account:
Filter Criteria
1. Current User Profile: Name equals value Domestic Sales
2. Account Name: Billing Country equals value USA
3. Current User Profile: Name not equal to value Domestic Sales
247
Extend Salesforce with Clicks, Not Code
Customize Fields
Filter Logic
(1 AND 2) OR 3
Custom Error Message
Account does not exist or the account billing country is not USA. Domestic sales
reps can only create opportunities for accounts in the United States.
Lookup Window Text
Search results show only United States accounts in the for domestic sales
representatives.
You can modify the above example to simultaneously restrict users with a “Global Sales” custom profile to only associating opportunities
to accounts with a non-US billing country:
Filter Criteria
1. Current User Profile: Name equals value Global Sales
2. Account Name: Billing Country not equal to value USA
3. Current User Profile: Name equals value Domestic Sales
4. Account Name: Billing Country equals value USA
5. Current User Profile: Name not equal to value Global Sales, Domestic Sales
Filter Logic
(1 AND 2) OR (3 AND 4) OR 5
Custom Error Message
Account does not exist or the account billing country is not in your sales area.
Sales reps can only create opportunities for accounts in their sales area.
Lookup Window Text
Search results only display accounts in your region.
Important: If you do not include line 5 in the filter criteria, users who are not in Global Sales or Domestic Sales cannot select or
save any values on account records.
Roles in Lookup Filters
When a business rule does not apply to users in every role, use the Current User Role global variable fields to define lookup
filters that only affect users with particular roles. For example, in a recruiting application that has a Position object with a lookup field to
a Compensation Package object, you can restrict users from editing or creating positions that have an executive compensation plan
unless they are executive administrators or vice presidents. To do this, define the following lookup filter on the Position object
Compensation Package Name field:
Filter Criteria
1. Current User Role: Name does not start with value VP
2. Current User Role: Name does not equal value Executive Administrator
3. Compensation Package: Plan Type does not equal value Executive
4. Current User Role: Name starts with value VP
5. Current User Role: Name equals value Executive Administrator
Filter Logic
((1 OR 2) AND 3) OR (4 OR 5)
248
Extend Salesforce with Clicks, Not Code
Customize Fields
Custom Error Message
The compensation plan does not exist, or you have selected an executive compensation
plan but do not have access to create executive positions.
Lookup Window Text
Search results only display compensation plans that are relevant to positions you
are allowed to create.
Important: Include the condition you are testing and the opposite condition. In this example, lines 1, 2, and 3 of the filter criteria
ensure that users who are not VPs or Executive Administrators cannot select Executive compensation plans, while lines 4 and 5
ensure that VPs and Executive Administrators can select Executive compensation plans.
Blank Values in Lookup Filters
Your lookup filter criteria might reference a field that users often leave blank. You can design your lookup filter criteria to accept blank
values by using the Add Filter Logic in the filter criteria to create an OR condition. For example, if you have a Partner Contact
custom field on opportunities, restrict the field to only allow contacts that are associated to an account with a Partner Account record
type, or private contacts not associated with any account.
Filter Criteria
1. Partner Contact: Account: Account Record Type
equals value Partner Account
2. Partner Contact: Account: Account Name equals value
Filter Logic
1 OR 2
Custom Error Message
The partner contact must be associated with a partner account, or must be a private
contact.
Lookup Window Text
Search results only display contacts from partner accounts or your private contacts.
User IDs in Lookup Filters
Using user IDs in optional lookup filters can significantly improve user efficiency by first showing lookup search dialog results that are
most relevant to the user while still allowing users to see all results if necessary. For example, on a lookup field to accounts, you can
create an optional lookup filter that restricts the search results to accounts that the user owns in the search lookup dialog results. If the
user is looking for an account that someone else owns, the user can remove the filter.
Filter Criteria
Current User: User ID equals Field Account: Owner ID
Lookup Window Text
By default, search results only display accounts you own. To search all accounts,
click “Show all results.”
Simple Dependent Lookups
If the value of a relationship field should depend on the value of another relationship field on the current record, specify the field to field
comparison in the criteria. For example, if the case Contact Name field should only have contacts associated to the account specified
in the case Account Name field, use the following lookup filter:
249
Extend Salesforce with Clicks, Not Code
Customize Fields
Filter Criteria
Contact Name: Account ID equals field Case: Account ID
Custom Error Message
Contact does not exist or is not associated to the case account.
Lookup Window Text
Search results only display contacts associated to the case account.
Note: When comparing lookup fields in lookup filter criteria, Salesforce always uses the ID of the relationship field, not the name.
Complex Lookup Filters and Dependent Lookups
Achieving complex business rules with lookup filters often involves combing your rules with filter logic and fields of various types. For
example, consider an app for booking conference rooms that has the following data model:
Object
Fields
Meeting
• Meeting Name
• Office lookup to the Office object
• Projector Required checkbox
• Number of Participants number field
• Conference Room lookup to the Conference Room object
Conference Room
• Conference Room Name
• Has Projector checkbox
• Number of Seats Available number field
• Conference Room Location lookup to the Office
object
Office
• Office Name
The following lookup filter on the meeting Conference Room field restricts the valid values to conference rooms that have a
projector if the meeting requires one, as well as the necessary number of seats:
Filter Criteria
1. Meeting: Projector Required equals field Meeting Conference Room: Has Projector
2. Meeting: Projector Required equals value False
3. Conference Room: Number of Seats Available greater or equal field Meeting: Number
of Participants
Filter Logic
(1 OR 2) AND 3
Custom Error Message
Conference room not found or is insufficient for your meeting.
250
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Lookup Window Text
Search results only display conference rooms that can support your meeting
requirements.
To refine the valid values even further, incorporate the office where the conference room is located:
Filter Criteria
1. Meeting: Projector Required equals field Meeting Conference Room: Has Projector
2. Meeting: Projector Required equals value False
3. Conference Room: Number of Seats Available greater than field Meeting: Number of
Participants
4. Meeting: Office equals Field Conference Room: Conference Room Location
Filter Logic
(1 OR 2) AND 3 AND 4
Custom Error Message
Conference room not found or is insufficient for your meeting.
Lookup Window Text
Search results only display conference rooms that can support your meeting
requirements.
SEE ALSO:
Considerations for Lookup Filters
Calculate Field Values With Formulas
A formula is an algorithm that derives its value from other fields, expressions, or values. Formulas
can help you automatically calculate the value of a field based on other fields.
EDITIONS
Watch a Demo:
Available in: both Salesforce
Classic and Lightning
Experience
Getting Started With Formulas (Salesforce Classic)
This video gives a brief introduction to Salesforce formulas, accessing the formulas editor in the
app, and how to use the editor tools to create formulas.
Available in: All Editions
Where are Formulas Used in Salesforce?
Many areas in Salesforce use formulas. Before you begin using formulas, review the differences
in their uses.
Reports and Approvals are
not available in
Database.com
Formula Data Types
The data type of a formula determines the type of data you expect returned from your formula.
Elements of a Formula
A formula can contain references to the values of fields, operators, functions, literal values, or other formulas.
Formula Operators and Functions
Use these operators and functions when building formulas. All functions are available everywhere that you can include a formula—such
as formula fields, validation rules, approval processes, and workflow rules, unless otherwise specified.
Using Date and Date/Time Values in Formulas
Date formulas are useful for managing payment deadlines, contract ages, or any other features of your organization that are time
or date dependent.
251
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Build a Formula Field
Your custom formula fields require special attributes.
Formula Field Limits and Restrictions
Before you create formula fields, be aware of their limits and limitations.
Examples of Advanced Formula Fields
Review examples of formula fields for various types of apps that you can use and modify for your own purposes.
Formulas: How Do I ... ?
Common Formula Errors
Review common errors that can occur with formulas and how to fix them.
Where are Formulas Used in Salesforce?
Many areas in Salesforce use formulas. Before you begin using formulas, review the differences in
their uses.
Use Formulas for:
To:
Approval Processes
Define the criteria a record must meet to enter the approval process.
Approval Steps
Define the criteria a record must meet to enter the approval step.
Assignment Rules for
Leads and Cases
Define the criteria the lead or case must meet for it to be assigned.
Auto-Response Rules for Define the criteria a lead or case must meet to trigger an auto-response
Leads and Cases
rule.
Case Escalation Rules
Specify criteria a case must meet for it to be escalated.
Custom Buttons and
Links
Define the content for custom links and buttons.
Custom Fields
Create custom formula fields that automatically calculate a value based
on other values, merge fields, or expressions. Users can view formula
fields on record detail pages but can’t see the underlying algorithm or
edit the value of a formula field.
Note: Custom formula fields are not available in Connect Offline,
Web-to-Lead forms, or Web-to-Case forms.
Custom Summary
Formulas in Reports
Automatically calculate more totals based on existing report summaries
using the values, merge fields, or expressions you specify. Users can’t
change these totals.
Data Validations
Verify that the data a user enters in a record meets the standards you
specify before the user can save the record. A validation rule can include
a formula such as CloseDate >= TODAY().
252
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: All Editions
Reports and Approvals are
not available in
Database.com
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Use Formulas for:
To:
Default Field Values
Apply a value to a custom field when a user creates a record. Use formulas to define a default value
such as TODAY() + 7.
Users can change a default value. Default field values can be based on a formula using values,
merge fields, or expressions you specify.
Escalation Rules
Define the criteria that a case must meet to be escalated.
Formula Fields
Automatically calculate the value of a custom field using the values, merge fields, or expressions
you specify. Users can’t change the value of a formula field.
Reports
Create custom summary formulas in your reports to calculate more totals based on the existing
summaries in that report.
S-Controls
Define the content for s-controls.
Validation Rules
Prevent users from entering an invalid value in a standard or custom field. Validation rules can be
based on formulas and display an error message to users when the value they enter is not valid.
Workflow Field Updates
Automatically change the value of a field to a value you specify. The formula can include other
values, merge fields, or expressions. You can set field updates to occur as a result of a workflow rule
or an approval process.
Workflow Rules
Define the criteria a record must meet to trigger a workflow rule.
Visualforce Pages
Define the content for Visualforce pages.
Common Formula Processes
When are they
executed?
Read only?
Can include
functions?
Can specify null
handling?
Can include
references to
parent merge
fields?
Default Field Values Record creation
No
Yes
No
No
Formula Fields
Record display
Yes
Yes
Yes
Yes
Validation Rules
Record save
Not applicable
Yes
No
Yes
Workflow Rules
Record save
Not applicable
Yes
No
Yes
Approval Processes
Record submitted
for approval
Not applicable
Yes
No
Yes
Field Updates
Workflow or
approval process
Not applicable
Yes
No
Yes
Yes
Yes, a limited subset Yes
of functions
No
Custom Summary
Report display
Formulas for Reports
253
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Formula Data Types
The data type of a formula determines the type of data you expect returned from your formula.
Data Type
Description
Checkbox
Returns a true or false value. The field appears as a checkbox in record detail pages and reports. Use
True for checked values and False for unchecked values.
Currency
Returns a number in currency format of up to 18 digits with a currency sign.
Note: Salesforce uses the round-half-to-even tie-breaking rule for currency fields. For example,
23.5 becomes 24, 22.5 becomes 22, −22.5 becomes −22, and −23.5 becomes −24.
Date
Returns data that represents a day on the calendar. The current date can be acquired by calling the
built-in function TODAY() in a formula. This data type is not available for custom summary formulas
in reports.
Date/Time
Returns data that represents a moment in time. A date/time field includes the date and also the time
of day including hour, minutes, and seconds. You can insert the current date and time in a formula
using the NOW() function. This data type is not available for custom summary formulas in reports.
Number
Returns a positive or negative integer or decimal of up to 18 digits. Salesforce uses the round half up
tie-breaking rule for numbers in formula fields. For example, 12.345 becomes 12.35 and −12.345
becomes −12.34.
Percent
Returns a number in percent format of up to 18 digits followed by a percent sign. Percent data is
stored as a decimal divided by 100, which means that 90% is equal to 0.90.
Text
Returns a string of up to 3900 characters. To display text in addition to the formula output, insert that
text in quotes. Use the text data type for text, text area, URL, phone, email, address, and auto-number
fields. This data type isn’t available for custom summary formulas in reports.
SEE ALSO:
Build a Formula Field
Elements of a Formula
A formula can contain references to the values of fields, operators, functions, literal values, or other formulas.
Use any or all of these elements to build a formula.
Element Description
Name
Literal
Value
A text string or number you enter that is not calculated or changed. For example, if you have a value that’s always multiplied
by 2% of an amount, your formula would contain the literal value of 2% of that amount:
ROUND((Amount*0.02), 2)
This example contains every possible part of a formula:
• A function called ROUND used to return a number rounded to a specified number of decimal places.
• A field reference called Amount.
254
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Element Description
Name
• An operator, *, that tells the formula builder to multiply the contents of the Amount field by the literal value, 0.02.
• A literal number, 0.02. Use the decimal value for all percents. To include actual text in your formula, enclose it in quotes.
• The last number 2 in this formula is the input required for the ROUND function that determines the number of decimal
places to return.
Field
Reference the value of another custom or standard field using a merge field. The syntax for a merge field is field_name
Reference for a standard field or field_name__c for a custom field. The syntax for a merge field on a related object is
object_name__r.field_name. Use the Insert Field button or the drop-down list to insert a merge field in your
formula where necessary.
Function A system-defined formula that can require input from you and returns a value or values. For example, TODAY() does not
require input but returns the current date. The TEXT(value) function requires your percent, number, or currency input and
returns text.
Operator A symbol that specifies the type of calculation to perform or the order in which to do it. For example, the + symbol specifies
two values should be added. The open and close parentheses specify which expressions you want evaluated first.
Comment An annotation within a formula that begins with a forward slash followed by an asterisk (/*). and concludes with an asterisk
followed by a forward slash (*/). For example,
/*This is a formula comment*/
Comments are ignored when processing a formula.
Comments are useful for explaining specific parts of a formula to anyone viewing the formula definition. For example:
AND(
/*competitor field is required, check to see if field is empty */
LEN(Competitor__c) = 0,
/* rule only enforced for ABCD record types */
RecordType.Name = "ABCD Value",
/* checking for any closed status, allows for additional closed picklist values
in the future */
CONTAINS(TEXT(StageName), "Closed")
)
You can also use comments to comment out sections of your formula when debugging and checking the syntax to locate
errors in the formula.
Note:
• Nesting comments causes a syntax error. For example, you cannot save a formula that has the following:
/* /* comment */ */
• Commenting out a whole formula causes a syntax error.
255
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Element Description
Name
• Comments count against the character and byte size limits in formulas.
SEE ALSO:
Build a Formula Field
Quick Reference Guide: Formula Fields
Formula Operators and Functions
Use these operators and functions when building formulas. All functions are available everywhere that you can include a formula—such
as formula fields, validation rules, approval processes, and workflow rules, unless otherwise specified.
Note: Extraneous spaces in the samples below are ignored.
• Math Operators
• Logical Operators
• Text Operators
• Date and Time Functions
• Logical Functions
• Math Functions
• Text Functions
• Summary Functions
• Advanced Functions
Math Operators
Operator
Description
+ (Add)
Calculates the sum of two values.
- (Subtract)
Calculates the difference of two values.
* (Multiply)
Multiplies its values.
/ (Divide)
Divides its values.
^ (Exponentiation)
Raises a number to a power of a specified number.
() (Open Parenthesis and
Close Parenthesis)
Specifies that the expressions within the open parenthesis and close parenthesis are evaluated first. All
other expressions are evaluated using standard operator precedence.
256
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Logical Operators
Operator
Description
= and == (Equal)
Evaluates if two values are equivalent. The = and == operator are interchangeable.
<> and != (Not Equal)
Evaluates if two values are not equivalent.
< (Less Than)
Evaluates if a value is less than the value that follows this symbol.
> (Greater Than)
Evaluates if a value is greater than the value that follows this symbol.
<= (Less Than or Equal)
Evaluates if a value is less than or equal to the value that follows this symbol.
>= (Greater Than or Equal) Evaluates if a value is greater than or equal to the value that follows this symbol.
&& (AND)
Evaluates if two values or expressions are both true. Use this operator as an alternative to the logical
function AND.
|| (OR)
Evaluates if at least one of multiple values or expressions is true. Use this operator as an alternative to
the logical function OR.
Text Operators
Operator
Description
& (Concatenate)
Connects two or more strings.
Date and Time Functions
Function
Description
DATE
Returns a date value from year, month, and day values you enter. Salesforce displays an error on the
detail page if the value of the DATE function in a formula field is an invalid date, such as February 29 in
a non-leap year.
DATEVALUE
Returns a date value for a date/time or text expression.
DATETIMEVALUE
Returns a year, month, day and GMT time value.
DAY
Returns a day of the month in the form of a number between 1 and 31.
MONTH
Returns the month, a number between 1 (January) and 12 (December) in number format of a given
date.
NOW
Returns a date/time representing the current moment.
TODAY
Returns the current date as a date data type.
YEAR
Returns the four-digit year in number format of a given date.
257
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Logical Functions
Function
Description
AND
Returns a TRUE response if all values are true; returns a FALSE response if one or more values are false.
BLANKVALUE
Determines if an expression has a value and returns a substitute expression if it does not. If the expression
has a value, returns the value of the expression.
CASE
Checks a given expression against a series of values. If the expression is equal to a value, returns the
corresponding result. If it is not equal to any values, it returns the else_result.
IF
Determines if expressions are true or false. Returns a given value if true and another value if false.
ISBLANK
Determines if an expression has a value and returns TRUE if it does not. If it contains a value, this function
returns FALSE.
ISCLONE
Checks if the record is a clone of another record and returns TRUE if one item is a clone. Otherwise,
returns FALSE.
ISNEW
Checks if the formula is running during the creation of a new record and returns TRUE if it is. If an existing
record is being updated, this function returns FALSE.
ISNULL
Determines if an expression is null (blank) and returns TRUE if it is. If it contains a value, this function
returns FALSE.
Important: Use ISBLANK instead of ISNULL in new formulas. ISBLANK has the same functionality
as ISNULL, but also supports text fields. Salesforce will continue to support ISNULL, so you do not
need to change any existing formulas.
ISNUMBER
Determines if a text value is a number and returns TRUE if it is. Otherwise, it returns FALSE.
NOT
Returns FALSE for TRUE and TRUE for FALSE.
NULLVALUE
Determines if an expression is null (blank) and returns a substitute expression if it is. If the expression is
not blank, returns the value of the expression.
Important: Use BLANKVALUE instead of NULLVALUE in new formulas. BLANKVALUE has the
same functionality as NULLVALUE, but also supports text fields. Salesforce will continue to support
NULLVALUE, so you do not need to change existing formulas.
OR
Determines if expressions are true or false. Returns TRUE if any expression is true. Returns FALSE if all
expressions are false.
PRIORVALUE
Returns the previous value of a field.
Math Functions
Function
Description
ABS
Calculates the absolute value of a number. The absolute value of a number is the number without its
positive or negative sign.
CEILING
Rounds a number up to the nearest integer.
258
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Function
Description
DISTANCE
Calculates the distance between two locations in miles or kilometers.
EXP
Returns a value for e raised to the power of a number you specify.
FLOOR
Returns a number rounded down to the nearest integer.
GEOLOCATION
Returns a geolocation based on the provided latitude and longitude. Must be used with the DISTANCE
function.
LN
Returns the natural logarithm of a specified number. Natural logarithms are based on the constant e
value of 2.71828182845904.
LOG
Returns the base 10 logarithm of a number.
MAX
Returns the highest number from a list of numbers.
MIN
Returns the lowest number from a list of numbers.
MOD
Returns a remainder after a number is divided by a specified divisor.
ROUND
Returns the nearest number to a number you specify, constraining the new number by a specified
number of digits.
SQRT
Returns the positive square root of a given number.
Text Functions
Function
Description
BEGINS
Determines if text begins with specific characters and returns TRUE if it does. Returns FALSE if it does
not.
BR
Inserts a line break in a string of text.
CASESAFEID
Converts a 15-character ID to a case-insensitive 18-character ID.
CONTAINS
Compares two arguments of text and returns TRUE if the first argument contains the second argument.
If not, returns FALSE.
FIND
Returns the position of a string within a string of text represented as a number.
GETSESSIONID
Returns the user’s session ID.
HTMLENCODE
Encodes text and merge field values for use in HTML by replacing characters that are reserved in HTML,
such as the greater-than sign (>), with HTML entity equivalents, such as &gt;.
HYPERLINK
Creates a link to a URL specified that is linkable from the text specified.
IMAGE
Inserts an image with alternate text and height/width specifications.
INCLUDES
Determines if any value selected in a multi-select picklist field equals a text literal you specify.
ISPICKVAL
Determines if the value of a picklist field is equal to a text literal you specify.
JSENCODE
Encodes text and merge field values for use in JavaScript by inserting escape characters, such as a
backslash (\), before unsafe JavaScript characters, such as the apostrophe (').
259
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Function
Description
JSINHTMLENCODE
Encodes text and merge field values for use in JavaScript inside HTML tags by replacing characters that
are reserved in HTML with HTML entity equivalents and inserting escape characters before unsafe
JavaScript characters. JSINHTMLENCODE(someValue) is a convenience function that is equivalent
to JSENCODE(HTMLENCODE((someValue)). That is, JSINHTMLENCODE first encodes
someValue with HTMLENCODE, and then encodes the result with JSENCODE.
LEFT
Returns the specified number of characters from the beginning of a text string.
LEN
Returns the number of characters in a specified text string.
LOWER
Converts all letters in the specified text string to lowercase. Any characters that are not letters are
unaffected by this function. Locale rules are applied if a locale is provided.
LPAD
Inserts characters you specify to the left-side of a text string.
MID
Returns the specified number of characters from the middle of a text string given the starting position.
RIGHT
Returns the specified number of characters from the end of a text string.
RPAD
Inserts characters that you specify to the right-side of a text string.
SUBSTITUTE
Substitutes new text for old text in a text string.
TEXT
Converts a percent, number, date, date/time, or currency type field into text anywhere formulas are
used. Also, converts picklist values to text in approval rules, approval step rules, workflow rules, escalation
rules, assignment rules, auto-response rules, validation rules, formula fields, field updates, and custom
buttons and links.
TRIM
Removes the spaces and tabs from the beginning and end of a text string.
UPPER
Converts all letters in the specified text string to uppercase. Any characters that are not letters are
unaffected by this function. Locale rules are applied if a locale is provided.
URLENCODE
Encodes text and merge field values for use in URLs by replacing characters that are illegal in URLs, such
as blank spaces, with the code that represent those characters as defined in RFC 3986, Uniform Resource
Identifier (URI): Generic Syntax. For example, blank spaces are replaced with %20, and exclamation points
are replaced with %21.
VALUE
Converts a text string to a number.
Summary Functions
The following functions are available with summary, matrix, and joined reports.
Function
Description
PARENTGROUPVAL
This function returns the value of a specified parent grouping. A “parent” grouping is any level above
the one containing the formula. You can only use this function in custom summary formulas for reports.
PREVGROUPVAL
This function returns the value of a specified previous grouping. A “previous” grouping is one that comes
before the current grouping in the report. Choose the grouping level and increment. The increment is
the number of columns or rows before the current summary. The default is 1; the maximum is 12. You
can only use this function in custom summary formulas for reports.
260
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Advanced Functions
Function
Description
GETRECORDIDS
Returns an array of strings in the form of record IDs for the selected records in a list, such as a list view
or related list.
INCLUDE
Returns content from an s-control snippet. Use this function to reuse common code in many s-controls.
ISCHANGED
Compares the value of a field to the previous value and returns TRUE if the values are different. If the
values are the same, this function returns FALSE.
JUNCTIONIDLIST
Returns a JunctionIDList based on the provided IDs.
LINKTO
Returns a relative URL in the form of a link (href and anchor tags) for a custom s-control or Salesforce
page.
REGEX
Compares a text field to a regular expression and returns TRUE if there is a match. Otherwise, it returns
FALSE. A regular expression is a string used to describe a format of a string according to certain syntax
rules.
REQUIRESCRIPT
Returns a script tag with source for a URL you specify. Use this function when referencing the Force.com
AJAX Toolkit or other JavaScript toolkits.
URLFOR
Returns a relative URL for an action, s-control, Visualforce page, or a file in a static resource archive in a
Visualforce page.
VLOOKUP
Returns a value by looking up a related value on a custom object similar to the VLOOKUP() Excel function.
Formula Operators and Functions A–H
Formula Operators and Functions I–Z
SEE ALSO:
Examples of Advanced Formula Fields
Formula Operators and Functions A–H
Use the following operators and functions when building formulas. Click on the name of the operator or function below to view more
details. All functions are available everywhere that you can include a formula such as formula fields, validation rules, approval processes,
and workflow rules, unless otherwise specified.
Note: Extraneous spaces in the samples below are ignored.
+ (Add)
Description:
Calculates the sum of two values.
Use:
value1 + value2 and replace each value with merge fields, expressions, or other numeric
values.
261
Extend Salesforce with Clicks, Not Code
Formula Field Example:
Calculate Field Values With Formulas
Amount + Maint_Amount__c + Services_Amount__c
This formula calculates the sum of the product Amount, maintenance amount, and services fees.
Note that Maint amount and Service Fees are custom currency fields.
Report Example:
EMAIL_OPT_OUT:SUM + DO_NOT_CALL:SUM calculates all Email Opt Out fields
plus all Do Not Call fields on the leads in your report. This formula is a number data type that
returns a positive integer.
Validation Rule Example:
You may have a custom object that allows users to track the total number of hours worked in a
week. Use the following example to ensure that users cannot save a time card record with more
than 40 hours in a work week.
Monday_Hours__c +
Tuesday_Hours__c +
Wednesday_Hours__c +
Thursday_Hours__c +
Friday_Hours__c > 40
Use a formula like this one in a validation rule to display the following error message when the total
number of hours entered for each work day is greater than 40: “Your total hours cannot exceed 40.”
This example requires five custom fields on your custom object, one for each day of work.
- (Subtract)
Description:
Calculates the difference of two values.
Use:
value1 - value2 and replace each value with merge fields, expressions, or other numeric
values.
Example:
Amount - Discount_Amount__c
This formula calculates the difference of the product Amount less the Discount Amount.
Note that Discount Amount is a custom currency field.
Report Example:
AMOUNT:SUM - Product.Discount_Amount__c:SUM calculates the difference of all
Amount fields and all Discounted Amount custom fields on the products in your report.
This formula is a currency data type that returns a currency sign and decimal places.
* (Multiply)
Description:
Multiplies its values.
Use:
value1 * value2 and replace each value with merge fields, expressions, or other numeric
values.
Example:
Consulting_Days__c * 1200
This formula calculates the number of consulting days times 1200 given that this formula field is a
currency data type and consulting charges a rate of $1200 per day. Note that Consulting
Days is a custom field.
262
Extend Salesforce with Clicks, Not Code
Report Example:
Calculate Field Values With Formulas
RowCount * AGE:AVG calculates the record count times the average age value of your report.
This formula is a number data type that returns a positive or negative integer or decimal.
/ (Divide)
Description:
Divides its values.
Use:
value1 / value2 and replace each value with merge fields, expressions, or other numeric
values.
Example:
AnnualRevenue/ NumberOfEmployees
This formula calculates the revenue amount per employee using a currency field.
IF(NumberOfOpportunities > 0,
NumberOfWonOpportunities / NumberOfOpportunities, null)
This formula calculates the win rate of opportunities on a campaign.
Report Example:
% Won Opportunities
WON:SUM / RowCount calculates the percent of Won opportunities using a record count
representing the number of all opportunities in your report. This formula is a number data type that
returns a positive or negative integer.
% Difference between Cost and Sales Price
(TOTAL_PRICE:SUM - QUANTITY:SUM * Product2.Cost__c:SUM) /
(QUANTITY:SUM * Product2.Cost__c:SUM) calculates the average percent difference
between what a product costs and its selling price on a product-by-product level. Note that
Product2.Cost__c:SUM is a custom currency field named Cost on products, which includes
the cost of each product. This formula is a percent data type that returns a positive or negative
integer. For best results, use this on a summary Opportunities with Products report that is summarized
by Product Name and includes summary totals for Quantity, Total Price, and Cost.
^ (Exponentiation)
Description:
Raises a number to a power of a specified number.
Use:
number^integer and replace number with a merge field, expression, or another numeric
value; replace integer with a merge field that contains an integer, expression, or any integer.
Example:
NumberOfEmployees^4 calculates the number of employees to the 4th power.
Report Example:
ACTIVE:SUM ^ 2 calculates the number of active Salesforce users to the 2nd power for
administration. This formula is a number data type that returns a positive integer.
Tips:
Avoid replacing integer with a negative number.
263
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
() (Open Parenthesis and Close Parenthesis)
Description:
Specifies that the expressions within the open parenthesis and close parenthesis are evaluated first.
All other expressions are evaluated using standard operator precedence.
Use:
(expression1) expression2... and replace each expression with merge fields,
expressions, or other numeric values.
Example:
(Unit_Value__c - Old_Value__c) / New_Value__c calculates the difference
between the old value and new valuedivided by the new value.
Report Example:
(DURATIONHOURS:SUM * RowCount) / 24 calculates the duration of all event times
the record count per 24 hours. This formula is a percent data type that returns a positive or negative
integer or decimal, representing what percent of a day is spent on events.
= and == (Equal)
Important: Don’t use this function for a null comparison, such as MyDateTime__c == null. Use ISBLANK instead.
Description:
Evaluates if two values are equivalent. The = and == operator are interchangeable.
Use:
expression1=expression2 or expression1 == expression2, and replace each
expression with merge fields, expressions, or other numeric values.
Example:
Due Date
Due Date = CreatedDate + 5 returns true if the due date is equal to five days following
a record’s created date.
Commission Amount
IF(Probability =1, ROUND(Amount*0.02, 2), 0)
This formula calculates the 2% commission amount of an opportunity that has a probability of 100%.
All other opportunities will have a commission value of 0.
Possible results:
• An opportunity with a Probability of 90% will have a commission of 0.
• An opportunity with a Probability of 100% and an Amount of $100,000 will have a
commission of $2,000.
<> and != (Not Equal)
Important: Don’t use this function for a null comparison, such as MyDateTime__c != null. Use ISBLANK instead.
Description:
Evaluates if two values are not equivalent.
Use:
expression1 <> expression2 or expression1 != expression2, and replace
each expression with merge fields, expressions, or other numeric values.
264
Extend Salesforce with Clicks, Not Code
Example:
Calculate Field Values With Formulas
IF(Maint_Amount__c + Services_Amount__c<> Amount,
"DISCOUNTED", "FULL PRICE")
This formula displays “DISCOUNTED” on product if its maintenance amount and services amount
do not equal the product amount. Otherwise, displays “FULL PRICE.” Note that this example uses
two custom currency fields for Maint Amount and Services Amount.
< (Less Than)
Description:
Evaluates if a value is less than the value that follows this symbol.
Use:
value1 < value2 and replace each value with merge fields, expressions, or other numeric
values.
Example:
IF(AnnualRevenue < 1000000, 1, 2) assigns the value “1” with revenues less than
one million and the value “2” to revenues greater than one million.
> (Greater Than)
Description:
Evaluates if a value is greater than the value that follows this symbol.
Use:
value1 > value2 and replace each value with merge fields, expressions, or other numeric
values.
Example:
IF(commission__c > 1000000, "High Net Worth", "General") assigns
the “High Net Worth” value to a commission greater than one million. Note, this is a text formula
field that uses a commission custom field.
<= (Less Than or Equal)
Description:
Evaluates if a value is less than or equal to the value that follows this symbol.
Use:
value1 <= value2 and replace each value with merge fields, expressions, or other numeric
values.
Example:
IF(AnnualRevenue <= 1000000, 1, 2) assigns the value “1” with revenues less than
or equal to one million and the value “2” with revenues greater than one million.
>= (Greater Than or Equal)
Description:
Evaluates if a value is greater than or equal to the value that follows this symbol.
Use:
value1 >= value2 and replace each value with merge fields, expressions, or other numeric
values.
265
Extend Salesforce with Clicks, Not Code
Example:
Calculate Field Values With Formulas
IF(Commission__c >= 1000000, "YES", "NO") assigns the “YES” value with a
commission greater than or equal to one million. Note, this is a text formula field that uses a custom
currency field called Commission.
&& (AND)
Description:
Evaluates if two values or expressions are both true. Use this operator as an alternative to the logical
function AND.
Use:
(logical1) && (logical2) and replace logical1 and logical2 with the values
or expressions that you want evaluated.
Example:
IF((Price<100 && Quantity<5),"Small", null)
This formula displays “Small” if the price is less than 100 and quantity is less than five. Otherwise,
this field is blank.
|| (OR)
Description:
Evaluates if at least one of multiple values or expressions is true. Use this operator as an alternative
to the logical function OR.
Use:
(logical1) || (logical2) and replace any number of logical references with the values
or expressions you want evaluated.
Example:
IF((ISPICKVAL(Priority, "High")) || (ISPICKVAL(Status , "New")),
ROUND(NOW()-CreatedDate, 0), null)
This formula returns the number of days a case has been open if the Status is new or the
Priority is high. If the case was opened today, this field displays a zero.
Validation Rule Example:
(Discount_Rate__c < 0) || (Discount_Rate__c > 0.40)
This validation rule formula displays the following error message when the Discount Rate
custom field is not between 0 and 40%: "Discount Rate cannot exceed 40%."
& (Concatenate)
Description:
Connects two or more strings.
Use:
string1&string2 and replace each string with merge fields, expressions, or other values.
Example:
"Expense-" & Trip_Name__c & "-" & ExpenseNum__c
This formula displays the text “Expense-” followed by trip name and the expense number. This is a
text formula field that uses an expense number custom field.
266
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
ABS
Description:
Calculates the absolute value of a number. The absolute value of a number is the number without
its positive or negative sign.
Use:
ABS(number) and replace number with a merge field, expression, or other numeric value that
has the sign you want removed.
Example:
ABS(ExpectedRevenue) calculates the positive value of the Expected Revenue amount
regardless of whether it is positive or negative.
AND
Description:
Returns a TRUE response if all values are true; returns a FALSE response if one or more values are
false. Use this function as an alternative to the operator && (AND).
Use:
AND(logical1,logical2,...) and replace logical1,logical2,... with the
values that you want evaluated.
Formula Field Example:
IF(AND(Price<1,Quantity<1),"Small", null)
This formula displays “Small” if the price and quantity are less than one. This field is blank if the asset
has a price or quantity greater than one.
BEGINS
Description:
Determines if text begins with specific characters and returns TRUE if it does. Returns FALSE if it does
not.
Use:
BEGINS(text, compare_text) and replace text, compare_text with the characters
or fields you want to compare.
Example:
IF(BEGINS (Product_type__c, "ICU"), "Medical", "Technical")
This example returns the text “Medical” if the text in any Product Type custom text field begins
with “ICU.” For all other products, it displays “Technical.”
Tips:
• This function is case sensitive so be sure your compare_text value has the correct
capitalization.
• When using this function in a validation rule or workflow rule, fields that are blank are considered
valid. For example, if you have a validation rule that tests to see if the serial number of an asset
begins with “3,” all assets that have a blank serial number are considered valid.
BLANKVALUE
Description:
Determines if an expression has a value and returns a substitute expression if it does not. If the
expression has a value, returns the value of the expression.
267
Extend Salesforce with Clicks, Not Code
Use:
Calculate Field Values With Formulas
BLANKVALUE(expression, substitute_expression) and replace expression
with the expression you want evaluated; replace substitute_expression with the value
you want to replace any blank values.
Example:
Example 1
BLANKVALUE(Department, “Undesignated”)
This formula returns the value of the Department field if the Department field contains a
value. If the Department field is empty, this formula returns the word Undesignated.
Example 2
(BLANKVALUE(Payment_Due_Date__c, StartDate +5)
This formula returns the date five days after the contract start date whenever Payment Due
Date is blank. Payment Due Date is a custom date field.
Tips:
• Use BLANKVALUE instead of NULLVALUE in new formulas. BLANKVALUE has the same
functionality as NULLVALUE, but also supports text fields. Salesforce will continue to support
NULLVALUE, so you do not need to change existing formulas.
• A field is not empty if it contains a character, blank space, or zero. For example, a field that
contains a space inserted with the spacebar is not empty.
• Use the BLANKVALUE function to return a specified string if the field does not have a value; use
the ISBLANK function if you only want to check if the field has a value.
• If you use this function with a numeric field, the function only returns the specified string if the
field does not have a value and is not configured to treat blank fields as zeroes.
BR
Description:
Inserts a line break in a string of text.
Use:
BR()
Example:
CASE(ShippingCountry,
"USA",
ShippingStreet & BR() &
ShippingCity & ",
" & ShippingState & " " &
ShippingPostalCode & BR()
& ShippingCountry,
"France",
ShippingStreet & BR() &
ShippingPostalCode & " " &
ShippingCity & BR() &
ShippingCountry, "etc")
This formula field displays a formatted mailing address for a contact in standard format, including
spaces and line breaks where appropriate depending on the country.
Tips:
• Do not remove the parentheses after the function name.
268
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
• Keep the parentheses empty. They do not need to contain a value.
• Remember to surround the BR() with concatenation operators: &.
• Avoid using this function in mail merge templates.
• This function is not available in custom buttons and links, s-controls, or reports.
CASE
Description:
Checks a given expression against a series of values. If the expression is equal to a value, returns the
corresponding result. If it is not equal to any values, it returns the else_result.
Use:
CASE(expression,value1, result1, value2, result2,...,
else_result) and replace expression with the field or value you want compared to each
specified value. Replace each value and result with the value that must be equivalent to return the
result entry. Replace else_result with the value you want returned when the expression does
not equal any values.
Formula Field Example:
Days Open for Cases
Use this example of a custom formula field called Days Open to display different text depending
on the number of days a case has been open:
CASE(Days_Open__c, 3,
"Reassign", 2, "Assign Task", "Maintain")
The following text is displayed:
• “Reassign” for any case open three days.
• “Assign Task” for any case open two days.
• “Maintain” for all other cases.
Last Activity Month
This formula field displays the month of the last activity or “None” if there are no activities.
CASE(MONTH(LastActivityDate),
1, "January",
2, "February",
3, "March",
4, "April",
5, "May",
6, "June",
7, "July",
8, "August",
9, "September",
10, "October",
11, "November",
12, "December",
"None")
269
Extend Salesforce with Clicks, Not Code
Default Value Example:
Calculate Field Values With Formulas
Discount Rate
Use the following default value formula to insert a different discount rate on an opportunity based
on the department of the person creating the opportunity:
CASE(User.Department, "IT", 0.25, "Field", 0.15, 0)
In this example, the formula inserts a discount rate of 25% on any opportunity created by a user in
the “IT” department or 15% on any opportunity created by someone in the “Field” department. A
zero is applied if the creator does not belong to either of these departments. This is a custom percent
field on opportunities that uses the standard user field Department.
Product Language
You may want to associate a product with its language so that your users know the type of
documentation or adapter to include. Use the following default value formula to automatically set
the language of a product based on the country of the user creating the product. In this example,
the default value is “Japanese” if the user's country is “Japan” and “English” if the user's country is
“US.” If neither is true, the default value “unknown” is inserted into the Product Language
field.
CASE($User.Country , "Japan", "Japanese", "US",
"English","unknown")
Tips:
• Be sure your value1, value2... expressions are the same data type.
• Be sure your result1, result2... expressions are the same data type.
• CASE functions cannot contain functions that return true or false. Instead, make true or false
expressions return numbers such as:
CASE(1, IF(ISPICKVAL (Term__c, "12"), 1, 0),
12 * Monthly_Commit__c,
IF(ISPICKVAL(Term__c, "24"), 1, 0),
24 * Monthly_Commit__c, 0)
In this formula, Term is a picklist field that is multiplied by the Monthly Commit whenever it
contains the value 1 for true.
• The else_result value is required.
• CASE functions return an error whenever any of the expressions return an error, regardless of
which one should be returned. For example, CASE(Field__c,"Partner", "P",
"Customer", "C", LEFT(Field__c, -5)) returns an error even if the value of
the field is “Partner” or “Customer” because the last statement is illogical.
• If the field in your CASE function is blank, it returns your else_result value. For example,
this formula: CASE(Days_Open__c, 3, "Reassign", 2, "Assign Task",
"Maintain") displays “Maintain” if the Days Open field is blank, 0, or any value other
than 2 or 3.
• Use CASE functions to determine if a picklist value is equal to a particular value. For example
the formula CASE(Term__c, "12", 12 * Monthly_Commit__c, "24", 24
* Monthly_Commit__c, 0) multiplies the Monthly Commit amount by 12
whenever the Term is 12 or multiplies the Monthly Commit amount by 24 whenever
the Term is 24. Otherwise, the result is zero.
270
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
CASESAFEID
Description:
Converts a 15-character ID to a case-insensitive 18-character ID.
Use:
CASESAFEID(id) and replace id with the object’s ID.
Example:
CASESAFEID (Id)
This formula replaces the 15-character ID with the 18-character, case-insensitive ID.
Tips:
• Convert to 18-character IDs for better compatibility with Excel.
• The CASESAFEID function is available everywhere that you can define a formula except reports
and s-controls.
CEILING
Description:
Rounds a number up to the nearest integer.
Use:
CEILING(number) and replace number with the field or expression you want rounded.
Example:
Rounding Up (literal value)
CEILING(2.5)
This formula returns 3, which is 2.5 rounded up to the nearest number.
Earthquake Magnitude
CEILING(Magnitude__c) returns the value of a formula number field that calculates the
magnitude of an earthquake up to the nearest integer.
CONTAINS
Description:
Compares two arguments of text and returns TRUE if the first argument contains the second
argument. If not, returns FALSE.
Use:
CONTAINS(text, compare_text) and replace text with the text that contains the
value of compare_text.
Example:
IF(CONTAINS(Product_Type__c, "part"), "Parts", "Service")
This formula checks the content of a custom text field named Product_Type and returns “Parts”
for any product with the word “part” in it. Otherwise, it returns “Service.” Note that the values are
case sensitive, so if a Product_Type field contains the text “Part” or “PART,” this formula returns
“Services.”
Tips:
• This function is case sensitive so be sure your compare_text value has the correct
capitalization.
271
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
• When using this function in a validation rule or workflow rule, fields that are blank are considered
valid. For example, if you have a validation rule that tests to see if the serial number of an asset
contains “A,” all assets that have a blank serial number are considered valid.
• The CONTAINS function does not support multi-select picklists. Use INCLUDES to see if a
multi-select picklist has a specific value.
DATE
Description:
Returns a date value from year, month, and day values you enter. Salesforce displays an error on the
detail page if the value of the DATE function in a formula field is an invalid date, such as February
29 in a non-leap year.
Use:
DATE(year,month,day) and replace year with a four-digit year, month with a two-digit
month, and day with a two-digit day.
Example:
DATE(2005, 01, 02) creates a date field of January 2, 2005.
DATEVALUE
Description:
Returns a date value for a date/time or text expression.
Use:
DATEVALUE(expression) and replace expression with a date/time or text value, merge
field, or expression.
Example:
Closed Date
DATEVALUE(ClosedDate) displays a date field based on the value of the Date/Time
Closed field.
Date Value
DATEVALUE("2005-11-15") returns November 15, 2005 as a date value.
Tips:
• If the field referenced in the function is not a valid text or date/time field, the formula field
displays #ERROR!
• When entering a date, surround the date with quotes and use the following format: YYYY-MM-DD,
that is, a four-digit year, two-digit month, and two-digit day.
• If the expression does not match valid date ranges, such as the MM is not between 01 and
12, the formula field displays #ERROR!
• Dates and times are always calculated using the user’s time zone, except in list views, reports,
and related lists. These items calculate dates and times using Coordinated Universal Time.
DATETIMEVALUE
Description:
Returns a year, month, day and GMT time value.
272
Extend Salesforce with Clicks, Not Code
Use:
Calculate Field Values With Formulas
DATETIMEVALUE(expression) and replace expression with a date/time or text value,
merge field, or expression.
Example:
Closed Date
DATETIMEVALUE(ClosedDate) displays a date field based on the value of the Date/Time
Closed field.
Date Value
DATETIMEVALUE("2005-11-15 17:00:00") returns November 15, 2005 5:00 PM GMT
as a date and time value.
Tips:
• DATETIMEVALUE is always calculated using GMT time zone and can’t be changed.
• When entering a specific date, surround the date with quotes and use the following format:
YYYY-MM-DD, that is, a four-digit year, two-digit month, and two-digit day.
• If the expression does not match valid date ranges, such as the MM is not between 01 and
12, the formula field displays #ERROR!
DAY
Description:
Returns a day of the month in the form of a number between 1 and 31.
Use:
DAY(date) and replace date with a date field or value such as TODAY().
Example:
DAY(Code_Freeze__c) returns the day in your custom code freeze date. Note this does not
work on date/time fields.
DISTANCE
Description:
Calculates the distance between two locations in miles or kilometers.
Use:
DISTANCE(mylocation1, mylocation2, 'unit') and replace mylocation1
and mylocation2 with two location fields, or a location field and a value returned by the
GEOLOCATION function. Replace unit with mi (miles) or km (kilometers).
Examples:
Distance between two geolocation fields
DISTANCE(warehouse_location__c, store_location__c, 'mi')
This formula returns the distance, in miles, between the warehouse and the store. In this example,
warehouse_location__c and store_location__c are the names of two custom
geolocation fields.
Distance between an address field and a geolocation field
DISTANCE(BillingAddress, store_location__c, 'mi')
This formula returns the distance, in miles, between an account’s billing address and a store. In this
example, BillingAddress is the standard billing address field on an Account object, and
store_location__c is the name of a custom geolocation field.
Distance between a custom geolocation field and fixed coordinates
273
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
DISTANCE(warehouse_location__c, GEOLOCATION(37.775,-122.418),
'km')
This formula returns the distance, in kilometers, between the warehouse and the known latitude
and longitude 37.775°, -122.418° (San Francisco).
Distances with conditions
IF(DISTANCE(warehouse_location__c, ShippingAddress, 'mi')<10,
"Near", "Far")
This formula updates a text formula field to Near if the distance between the warehouse and the
account shipping address compound field is less than 10 miles. Otherwise, it updates the text field
to Far.
Tip: Although DISTANCE can be calculated in miles or kilometers, the unit is not returned
in the calculation. If possible, include the unit of measure in the name of your distance formula
field, so users know whether the distance is in miles or kilometers.
Tips:
• The DISTANCE function returns a number data type. Distance is always calculated in decimals,
even if you’re displaying the geolocation notation in degrees, minutes, and seconds in the user
interface. Specify the number of decimal places to show when you create a custom field.
• The DISTANCE function isn’t available in reports, but it can be used in list views. To use DISTANCE
in your reports, set up a formula field, and then reference the field in your reports.
• DISTANCE is the only formula function that can use GEOLOCATION parameters.
• There are limitations on DISTANCE accuracy and equality calculations.
– DISTANCE supports only the logical operators > and <, returning values within (<) or beyond
(>) a specified radius.
– Distance is calculated as a straight line—as the crow flies—regardless of geography and
topography between the two points.
For additional details, see “How SOQL Calculates and Compares Distances” in the Force.com
SOQL and SOSL Reference.
EXP
Description:
Returns a value for e raised to the power of a number you specify.
Use:
EXP(number) and replace number with a number field or value such as 5.
Example:
Exponent of a Literal Value
EXP(3)
This formula returns the value of e to the third power.
Compound Interest
Principal__c * EXP(Rate__c * Years__c)
This formula calculates the compound interest based on a custom currency field for principal, custom
percent field for rate, and custom number field for years.
274
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
FIND
Description:
Returns the position of a string within a string of text represented as a number.
Use:
FIND(search_text, text[, start_num]) and replace search_text with the
string you want to find, replace text with the field or expression you want to search, and replace
start_num with the number of the character from which to start searching from left to right.
Example:
Street Address
FIND(" ", Street) returns the character position of the first space in the Street field.
You can use this number to find out the length of the street address as a means of separating a
street address from street name in an address field.
Deriving Website Addresses
SUBSTITUTE(Email, LEFT(Email, FIND("@", Email)), "www.") finds the
location of the @ sign in a person's email address to determine the length of text to replace with a
“www.” as a means of deriving their website address.
Tips:
• Be sure to remove the brackets, [ and ], from your formula before validating it.
• If the field referenced in your text parameter is blank, the formula field displays 0.
• Your search_text parameter is case sensitive and cannot contain any wildcard characters.
• If your search does not return any results, a 0 displays in the field.
• The start_num parameter is optional. If you do not enter a start_num value, the formula
uses the value one, or the first character in the string.
• If your start_num is not greater than zero, a 0 displays in the field.
• If your start_num is greater than the length of the text, a 0 displays in the field.
• When entering your start_num parameter, remember that some fields like the Website
field are unique because a “http://” is automatically appended to the beginning of the text you
enter.
• Note that the first character in a string is designated as one rather than zero.
FLOOR
Description:
Returns a number rounded down to the nearest integer.
Use:
FLOOR(number) and replace number with a number field or value such as 5.245.
Example:
Commission Amounts
FLOOR(commission__c) rounds commission down to the nearest integer.
GEOLOCATION
Description:
Returns a geolocation based on the provided latitude and longitude. Must be used with the DISTANCE
function.
275
Extend Salesforce with Clicks, Not Code
Use:
Calculate Field Values With Formulas
GEOLOCATION(latitude, longitude) and replace latitude and longitude
with the corresponding geolocation, numerical code values.
Examples:
Distance between a custom geolocation field and fixed coordinates
DISTANCE(warehouse_location__c, GEOLOCATION(37.775,-122.418),
'km')
This formula returns the distance, in kilometers, between the warehouse and the known latitude
and longitude 37.775°, -122.418° (San Francisco).
Tips:
• The GEOLOCATION function returns a location data type that can be used only by, and must be
used with, the DISTANCE function. The GEOLOCATION function doesn’t work on its own.
GETRECORDIDS
Description:
Returns an array of strings in the form of record IDs for the selected records in a list, such as a list
view or related list.
Use:
{!GETRECORDIDS(object_type)} and replace object_type with a reference to the
custom or standard object for the records you want to retrieve.
Custom Button Example:
{!REQUIRESCRIPT ("/soap/ajax/13.0/connection.js")} var records =
{!GETRECORDIDS($ObjectType.Sample)}; var
newRecords = []; if (records[0] == null) { alert("Please select
at least one row") } else {
for (var n=0; n<records.length; n++) { var c =
new sforce.SObject("Case"); c.id = records[n]; c.Status = "New";
newRecords.push(c); } result =
sforce.connection.update(newRecords); window.location.reload(); }
In this example, all selected case records are updated with a Status of “New.” To set this up in
your organization, create a custom list button for cases with the following attributes:
• Display Type is “List Button”
• Behavior is “Execute JavaScript”
• Content Source is “OnClick JavaScript”
Paste the sample code above into the content of your custom button. Finally, add the list button
to the a page layout that contains the Cases related list, such as accounts or opportunities. Users
can select any number of cases in the related list and click the list button to change the status of
those cases at once. Notice the check for records[0] == null, which displays a message
to users when they do not select at least one record in the list.
Tips:
• Use global variables to access special merge fields for s-controls, custom buttons, and links.
• Activities are special types of objects. Use {!GETRECORDIDS($ObjectType.Task)} when creating
a task list button. Use {!GETRECORDIDS($ObjectType.Event)} when creating an event list button.
• This function is only available in custom buttons, links, and s-controls.
276
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
GETSESSIONID
Description:
Returns the user’s session ID.
Use:
GETSESSIONID()
Example:
HYPERLINK
("https://www.myintegration.com?sId="&
GETSESSIONID() & "?&rowID="&Name & "action=CreateTask","Create
a Meeting Request")
creates a link to an application outside of Salesforce, passing the parameters so that it can connect
to Salesforce via the API and create the necessary event.
Tips:
Important: $Api.Session_ID and GETSESSIONID() return the same value, an
identifier for the current session in the current context. This context varies depending on
where the global variable or function is evaluated. For example, if you use either in a custom
formula field, and that field is displayed on a standard page layout in Salesforce Classic, the
referenced session will be a basic Salesforce session. That same field (or the underlying variable
or formula result), when used in a Visualforce page, references a Visualforce session instead.
Session contexts are based on the domain of the request. That is, the session context changes
whenever you cross a hostname boundary, such as from .salesforce.com to
.visual.force.com or .lightning.force.com.
Session identifiers from different contexts, and the sessions themselves, are different. When
you transition between contexts, the old session is replaced by the new one, and the old
session is no longer valid. The session ID also changes at this time.
Normally Salesforce transparently handles session hand-off between contexts, but if you’re
passing the session ID around yourself, be aware that you might need to re-access
$Api.Session_ID or GETSESSIONID() from the new context to ensure a valid
session ID.
Note also that not all sessions are created equal. In particular, sessions obtained in a Lightning
Experience context have reduced privileges, and don't have API access. You can't use these
session IDs to make API calls.
HTMLENCODE
Description:
Encodes text and merge field values for use in HTML by replacing characters that are reserved in
HTML, such as the greater-than sign (>), with HTML entity equivalents, such as &gt;.
Use:
{!HTMLENCODE(text)} and replace text with the merge field or text string that contains
the reserved characters.
Example:
If the merge field foo__c contains <B>Enter the user's name<b>,
{!HTMLENCODE(foo__c)} results in: &lt;B&gt;Enter the user&#39;s
name&lt;/b&gt;
Tips:
This function is only available in custom buttons and links, and in Visualforce.
277
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
HYPERLINK
Description:
Creates a link to a URL specified that is linkable from the text specified.
Use:
HYPERLINK(url, friendly_name [,target]) and replace url with the Web
address, replace friendly_name with the link text, and, optionally, replace target with the
window or frame in which to display the content.
Example:
Creating Events
HYPERLINK("/00U/e?
retURL=%2F006x0000001T8Om&what_id="
& Id,
"Create Event")
adds a link called “Create Event” that, when clicked, creates a new event that is associated with the
current object.
Phone Dialer
HYPERLINK("http://servername/call?id=" & Id & "&phone=" & Phone,
Phone)creates a linkable phone number field that automatically dials the phone number when
clicked. In this example, replace "servername" and "call" with the name of your dialing
tool and the command it uses to dial. The merge field, Id, inserts the identifier for the contact, lead,
or account record. The first Phone merge field tells the dialing tool what number to call and the
last Phone merge field uses the value of the Phone field as the linkable text the user clicks to
dial.
Tips:
• Hyperlink formula fields are of type text.
• Include the protocol and URL in quotes as in HYPERLINK("http://www.cnet.com",
"cnet").
• Avoid using text functions such as LEN, LEFT, or RIGHT on HYPERLINK function results.
• The URL can’t contain JavaScript. This increases security for your org. Using JavaScript is permitted
in packages, sandbox copies, and change sets.
• When linking to Salesforce pages, use a relative link, such as “/00U/e?retURL=%...”, for hyperlink
formulas unless you want to add the formula field to a search layout. Use the complete URL,
including the server name and https://, in a hyperlink formula to add it to a search layout. Note
that formula fields are not available in search result layouts.
• Use the $Api variable to reference API URLs.
• Be sure to remove the brackets, [ and ], from your formula before validating it.
• The target parameter is optional. If you do not specify a target, the link opens in a new
browser window. Some common target parameters are:
_blank
Displays link in a new unnamed window.
_self
Displays link in the same frame or window as the element that refers to it.
_parent
Displays link in the immediate frameset parent of the current frame. This value is the same
as _self if the current frame has no parent.
278
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
_top
Displays link in the full original window, canceling any other frames. This value is the same
as _self if the current frame has no parent.
For more information on basic HTML tags, consult an HTML reference on the Internet.
• The HYPERLINK function is available everywhere that you can define a formula except default
values, field updates, s-controls, validation rules, approval processes, custom buttons and links,
and workflow rules.
SEE ALSO:
Formula Operators and Functions I–Z
Formula Operators and Functions
Formula Operators and Functions I–Z
Use the following operators and functions when building formulas. Click the name of the operator or function to view more details. All
functions are available everywhere that you can include a formula such as formula fields, validation rules, approval processes, and
workflow rules, unless otherwise specified.
Note: Extraneous spaces in the samples are ignored.
IF
Description:
Determines if expressions are true or false. Returns a given value if true and another value if false.
Use:
IF(logical_test, value_if_true, value_if_false) and replace
logical_test with the expression you want evaluated; replace value_if_true with the
value you want returned if the expression is true; replace value_if_false with the value you
want returned if the expression is false.
Formula Field Example:
Overdue Payments
IF(AND(Payment_Due_Date__c < TODAY(),Payment_Status__c ="UNPAID")
, "PAYMENT OVERDUE", null)
This formula determines if the payment due date is past and the payment status is “UNPAID.” If so,
returns the text “PAYMENT OVERDUE” and if not, leaves the field blank. This example uses a custom
date field called Payment Due Date and a text custom field called Payment Status.
Insert Tax Rate
Use this default value formula to set the tax rate of an asset based on the user's city. Create a custom
percent field with the following default value:
IF($User.City = "Napa", 0.0750,
IF($User.City = "Paso Robles", 0.0725,
IF($User.City = "Sutter Creek", 0.0725,
IF($User.City = "Los Olivos", 0.0750,
IF($User.City = "Livermore", 0.0875, null
)
)
279
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
)
)
)
Custom Button Example:
{!
IF(Sample.BillingCountry = "US",
"http://maps.google.com/maps?q="&Sample.BillingStreet&
"+"&Sample.BillingCity&"+"&Sample.BillingState&"+
"&Sample.BillingCountry,
(IF(Sample.BillingCountry = "UK",
"http://maps.google.co.uk/maps?q="&Sample.BillingStreet
&"+"&Sample.BillingCity&"+"&Sample.BillingCountry,
"http://maps.google.com")))
}
This example uses the IF function to determine if an address is in the United States or United Kingdom
so that it can use the appropriate type of Google map to display the address.
Tips:
• Make sure your value_if_true and value_if_false expressions are the same data
type.
• When using an IF function with the $Profile.UserType variable to determine the type of Salesforce
user license the logged in user has, use the following values:
– Standard for Salesforce
– PowerPartner for PRM User
– CustomerSuccess for Customer Portal User
– PowerCustomerSuccess for Customer Portal Manager
For example, use the following formulas to determine if the logged in user has the license type
in quotes:
IF(ISPICKVAL($Profile.UserType ,"Standard"), 100, 0.1)
IF(ISPICKVAL($Profile.UserType ,"PowerPartner"), 100, 0.1)
IF(ISPICKVAL($Profile.UserType ,"CustomerSuccess"), 100, 0.1)
Note: $Profile merge fields are only available in Enterprise, Unlimited, Performance, and
Developer Editions.
IMAGE
Description:
Inserts an image with alternate text and height/width specifications.
Use:
IMAGE(image_url, alternate_text, height, width) and replace image_url
with the full path to the image. Replace alternate_text with the string of text you want to
appear when the image can’t be rendered for some reason. This text can be used by screen reader
software. Replace height with the vertical size of the image in pixels. Replace width with the
horizontal size of the image in pixels.
280
Extend Salesforce with Clicks, Not Code
Example:
Calculate Field Values With Formulas
HYPERLINK("ymsgr:sendIM?" & Yahoo_Name__c,
IMAGE("http://opi.yahoo.com/online?u=" & Yahoo_Name__c &
"&m;=g&t;=0", "Yahoo"))
This formula displays a clickable Yahoo! Messenger icon indicating if the person is logged on to the
service. Users can click the icon to launch a Yahoo! Messenger conversation with the person. This
example uses a custom text field called Yahoo Name on contacts where you can store the
contact's Yahoo! Messenger ID.
Tips:
• The height and width parameters are optional.
• Use a text string to replace the image_url and alternate_text parameters. Surround
each text string in quotes.
• Use numbers to replace the height and width parameters.
• Add images to your Documents tab if you want to display them elsewhere. For example, store
the image of a product in a document folder, copy the URL to the document, and paste that
URL in the image_url parameter of a formula field on the Products tab.
• If you use Internet Explorer, you might need to change your security settings so that Explorer
does not display a warning prompt when images use HTTP protocol. See the online help for
Internet Explorer for instructions on changing your security settings.
• The IMAGE function cannot include the GETSESSIONID function as one of its arguments.
• The IMAGE function is available only in formula fields and email templates.
INCLUDE
Description:
Returns content from an s-control snippet. Use this function to reuse common code in many
s-controls.
Use:
{!INCLUDE(source, [inputs])} and replace source with the s-control snippet you
want to reference. Replace inputs with any information you need to pass to the snippet.
S-Control Example:
Including Header Snippet
<html> <body> {! INCLUDE($SControl.Header_Snippet, [title = "My
Title",
theme = "modern"])} </body> </html>
This example references a snippet that provides a header for a page that you created to display in
a Web tab. It displays the page title “My Title.” Use the $SControl global variable to reference a
custom s-control.
Including Input Parameters
Use the following two examples to see how you can create a reusable snippet and include it in an
s-control.
<h2
class=”{!$Request.titleTheme}.title”>
{!$Request.titleText}</h2>
281
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
This snippet requires two input parameters: titleTheme and titleText. It is a reusable
HTML tag that presents a page title and theme based on input parameters. Next, create an s-control
that includes this snippet:
<html> <head> </head> <body> {!
INCLUDE($SControl.Title_Snippet, [titleTheme =
"modern", titleText = "My Sample Title"]) } ... Insert your page
specific content
here ... </body> </html>
This s-control uses the snippet titled Title_Snippet to display the title of the page “My Sample Title”
and modern theme. Replace Insert your page specific content here with your
own HTML content and use the s-control as the source of a Web tab to create your own pages in
Salesforce.
Tips:
• Because this function references an s-control snippet and does not copy it, it always runs the
latest content of the s-control snippet. Remember that making a change to your s-control snippet
affects all INCLUDE functions that refer to it.
• Use the $Request global variable to access any information inside the snippet.
• This function is only available in custom buttons, links, and s-controls.
INCLUDES
Description:
Determines if any value selected in a multi-select picklist field equals a text literal you specify.
Use:
INCLUDES(multiselect_picklist_field, text_literal) and replace
multiselect_picklist_field with the merge field name for the multi-select picklist;
and replace text_literal with the multi-select picklist value you want to match in quotes.
Examples:
INCLUDES(Hobbies__c, "Golf") returns TRUE if one of the selected values in the
Hobbies custom multi-select picklist field is Golf.
Tips:
• The text_literal expression must be of type text and enclosed in quotes. It cannot be a
merge field or the result of a function.
• Salesforce returns an error if any of the following occurs:
– You do not provide a text_literal expression.
– You provide an empty text_literal expression, such as "" or " ".
• Use ISBLANK to determine if a multi-select picklist field is empty.
• Use the PRIORVALUE function inside the INCLUDES function to check if the previous value of a
multi-select picklist field included a specific value. For example:
INCLUDES(
PRIORVALUE(multiselect_picklist_field),
text_literal
)
282
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
ISBLANK
Description:
Determines if an expression has a value and returns TRUE if it does not. If it contains a value, this
function returns FALSE.
Use:
ISBLANK(expression) and replace expression with the expression you want evaluated.
Example:
(IF(ISBLANK(Maint_Amount__c), 0, 1) +
IF(ISBLANK(Services_Amount__c), 0,1) +
IF(ISBLANK(Discount_Percent__c), 0, 1) +
IF(ISBLANK(Amount), 0, 1) +
IF(ISBLANK(Timeline__c), 0, 1)) / 5
This formula takes a group of fields and calculates what percent of them are being used by your
personnel. This formula field checks five fields to see if they are blank. If so, a zero is counted for that
field. A “1” is counted for any field that contains a value, and this total is divided by five (the number
of fields evaluated). This formula requires you to select the Treat blank fields as blanks option
under Blank Field Handling while the Advanced Formula subtab is showing.
Tips:
• Use ISBLANK instead of ISNULL in new formulas. ISBLANK has the same functionality as ISNULL,
but also supports text fields. Salesforce will continue to support ISNULL, so you do not need to
change any existing formulas.
• A field is not empty if it contains a character, blank space, or zero. For example, a field that
contains a space inserted with the spacebar is not empty.
• Use the BLANKVALUE function to return a specified string if the field does not have a value; use
the ISBLANK function if you only want to check if the field has a value.
• If you use this function with a numeric field, the function only returns TRUE if the field has no
value and is not configured to treat blank fields as zeroes.
• If you use this function with a picklist, use ISBLANK(TEXT(<picklist>)) to convert the picklist items
into a text value.
ISCHANGED
Description:
Compares the value of a field to the previous value and returns TRUE if the values are different. If
the values are the same, this function returns FALSE.
Use:
ISCHANGED(field) and replace field with the name of the field you want to compare.
Validation Rule Example:
The following validation rule prevents users from changing an object name after it has been created:
NOT(ISCHANGED(Name)).
NOT(AND(ISCHANGED(Priority), ISPICKVAL(Priority, “Low”))) is a
validation rule that ensures if a user changes the Priority of a case, the new priority cannot be
“Low.”
NOT(AND(ISCHANGED(CloseDate), OR(MONTH(CloseDate) <>
MONTH(TODAY()), YEAR(CloseDate) <> YEAR(TODAY())),$Profile.Name
<> "Sales Manager")) is a validation rule that prevents a user from changing the Close
283
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Date of an opportunity to a date outside of the current month and year unless that user has the
“Sales Manager” profile.
Note: $Profile merge fields are only available in Enterprise, Unlimited, Performance, and
Developer Editions.
Tips:
• This function is available only in:
– Assignment rules
– Validation rules
– Field updates
– Workflow rules if the evaluation criteria is set to Evaluate the rule when a
record is: created, and every time it’s edited .
– Formula criteria for executing actions in the Process Builder.
• Use the NOT function to reverse the return values of TRUE and FALSE.
• This function returns FALSE when evaluating any field on a newly created record.
• If a text field was previously blank, this function returns TRUE when it contains any value.
• For number, percent, or currency fields, this function returns TRUE when:
– The field was blank and now contains any value
– The field was zero and now is blank
– The field was zero and now contains any other value
ISCLONE
Description:
Checks if the record is a clone of another record and returns TRUE if one item is a clone. Otherwise,
returns FALSE.
Use:
ISCLONE()
Validation Rule Example:
Use (ISCLONE() to create a validation rule on an object and identify a record that’s a clone of
another record.
Tips:
• This function cannot be used with fields.
• Use the NOT function to reverse the return values of TRUE and FALSE.
ISNEW
Description:
Checks if the formula is running during the creation of a new record and returns TRUE if it is. If an
existing record is being updated, this function returns FALSE.
Use:
ISNEW()
284
Extend Salesforce with Clicks, Not Code
Validation Rule Example:
Calculate Field Values With Formulas
Use the following validation rule to prevent users from creating a record with a close date in the
past. AND (ISNEW(), CloseDate < TODAY()) checks if the user is creating a new
opportunity and, if so, ensures that the Close Date is today or after today.
Use this validation rule to ensure users add at least one product to an opportunity after they have
created it.
NOT(OR(ISNEW(),HasOpportunityLineItem))
In this example, the validation rule formula displays the following error message when an existing
opportunity does not have any products: “You must add products to this opportunity before saving.”
This does not display an error on the initial save because they cannot add products until after saving
the record initially; but it prevents them from resaving or closing an opportunity that does not
contain products.
Tips:
• This function is available only in validation rules, field updates, workflow rules, assignment rules,
and Process Builder formula criteria.
• Use the NOT function to reverse the return values of TRUE and FALSE.
• This function always returns FALSE when used in a workflow rule with a time-based trigger.
• This function always returns FALSE when used in a field update for an approval action.
ISNULL
Important: Use ISBLANK instead of ISNULL in new formulas. ISBLANK has the same functionality as ISNULL, but also supports
text fields. Salesforce will continue to support ISNULL, so you do not need to change any existing formulas.
Description:
Determines if an expression is null (blank) and returns TRUE if it is. If it contains a value, this function
returns FALSE.
Use:
ISNULL(expression) and replace expression with the expression you want evaluated.
Example:
(IF(ISNULL(Maint_Amount__c), 0, 1) +
IF(ISNULL(Services_Amount__c), 0,1) +
IF(ISNULL(Discount_Percent__c), 0, 1) +
IF(ISNULL(Amount), 0, 1) +
IF(ISNULL(Timeline__c), 0, 1)) / 5
This formula takes a group of fields and calculates what percent of them are being used by your
personnel. This formula field checks five fields to see if they are blank. If so, a zero is counted for that
field. A “1” is counted for any field that contains a value, and this total is divided by five (the number
of fields evaluated). This formula requires you to select the Treat blank fields as blanks option
under Blank Field Handling while the Advanced Formula subtab is showing.
Validation Rule Example:
AND(ISPICKVAL(StageName, "Closed Won"),
ISNULL(Project_Start_Date__c))
This validation rule makes the Project Start Date custom date field conditionally required
whenever the stage is Closed Won.
285
Extend Salesforce with Clicks, Not Code
Tips:
Calculate Field Values With Formulas
• Text fields are never null, so using this function with a text field always returns false. For example,
the formula field IF(ISNULL(new__c) 1, 0) is always zero regardless of the value in
the New field. For text fields, use the ISBLANK function instead.
• Multi-select picklist fields are never null in s-controls, buttons, and email templates, so using
this function with a multi-select picklist field in those contexts always returns false.
• Empty date and date/time fields always return true when referenced in ISNULL functions.
• Don’t use ISNULL for date/time fields.
• Choose Treat blank fields as blanks for your formula when referencing a number, percent,
or currency field in an ISNULL function. Choosing Treat blank fields as zeroes gives blank
fields the value of zero so none of them will be null.
• Merge fields can be handled as blanks, which can affect the results of components like s-controls
because they can call this function.
• When using a validation rule to ensure that a number field contains a specific value, use the
ISNULL function to include fields that do not contain any value. For example, to validate that a
custom field contains a value of '1', use the following validation rule to display an error if the
field is blank or any other number:
OR(ISNULL(field__c), field__c<>1)
ISNUMBER
Description:
Determines if a text value is a number and returns TRUE if it is. Otherwise, it returns FALSE.
Use:
ISNUMBER(text) and replace text with the merge field name for the text field.
Validation Rule Example:
OR(LEN(Bank_Account_Number__c) <> 10,
NOT(ISNUMBER(Bank_Account_Number__c)))
This validation rule ensures a custom text field called Bank Account Number is a number of
10 digits and is not blank.
Tips:
• This function returns FALSE for blank values.
• The ISNUMBER function is not aware of your locale. For example, ISNUMBER("123,12")
and ISNUMBER("1 000") return FALSE even if the user's locale is “French.”
• Chinese, Japanese, Korean, and special characters including a space return FALSE.
• The ISNUMBER function returns TRUE for scientific formatting such as “2E2” or “123.123.”
ISPICKVAL
Description:
Determines if the value of a picklist field is equal to a text literal you specify.
Use:
ISPICKVAL(picklist_field, text_literal) and replace picklist_field
with the merge field name for the picklist; replace text_literal with the picklist value in
quotes. text_literal cannot be a merge field or the result of a function.
286
Extend Salesforce with Clicks, Not Code
Examples:
Calculate Field Values With Formulas
Contract Activation
IF(ISPICKVAL(Status, "Activated"), NOW()-ActivatedDate, null)
calculates the number of days since the contract was activated. If the contract status is not “Activated,”
this field is blank.
Commission Amounts
IF(ISPICKVAL(StageName, "Closed Won"),
ROUND(Amount *0.02, 2), 0)
This example calculates the commission amount for any opportunity that has a “Closed Won” stage.
The value of this field will be the amount times 0.02 for any closed/won opportunity. Open or lost
opportunities will have a zero commission value.
Competitor-Triggered Workflow
ISPICKVAL(Stage, “Closed Lost”) && INCLUDES(Competitor__c, “Acme”)
In a workflow rule or the Process Builder, this formula configures Salesforce to trigger the associated
actions if the Competitor multi-select picklist field on a lost business is Acme.
Tips:
• Replace picklist_field with a custom or standard field of type picklist.
• Your text_literal expression must be of type text and enclosed in quotes. It cannot be
a merge field or the result of a function.
• Use CASE functions to determine if a picklist value is equal to a particular value.
• When using the ISPICKVAL function to return the previous value of a picklist field, include the
PRIORVALUE function inside the ISPICKVAL function as in this example:
ISPICKVAL(PRIORVALUE
(picklist_field),
text_literal)
JSENCODE
Description:
Encodes text and merge field values for use in JavaScript by inserting escape characters, such as a
backslash (\), before unsafe JavaScript characters, such as the apostrophe (').
Use:
{!JSENCODE(text)} and replace text with the merge field or text string that contains the
unsafe JavaScript characters.
Example:
If the merge field foo__c contains <B>Enter the user's name<b>,
{!JSENCODE(foo__c)} results in: \u003CB\u003EEnter the user\'s
name\u003C\/b\u003E
Tips:
This function is only available in custom buttons and links, and in Visualforce.
287
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
JSINHTMLENCODE
Description:
Encodes text and merge field values for use in JavaScript inside HTML tags by replacing characters
that are reserved in HTML with HTML entity equivalents and inserting escape characters before
unsafe JavaScript characters. JSINHTMLENCODE(someValue) is a convenience function that
is equivalent to JSENCODE(HTMLENCODE((someValue)). That is, JSINHTMLENCODE
first encodes someValue with HTMLENCODE, and then encodes the result with JSENCODE.
Use:
{!JSINHTMLENCODE(text)} and replace text with the merge field or text string that
contains the unsafe JavaScript characters.
Example:
If the merge field foo__c contains <B>Enter the user's name<b>,
{!JSINHTMLENCODE(foo__c)} results in: &lt;B&gt;Enter the user&#39;s
name&lt;/b&gt;
Tips:
• This function is only available in custom buttons and links, and in Visualforce.
JUNCTIONIDLIST
Description:
Returns a JunctionIDList based on the provided IDs.
A JunctionIDList is a string array of referenced ID values that represent the many-to-many relationship
of an underlying junction entity.
Use:
JUNCTIONIDLIST(id, id,...) and replace id with the Salesforce ID you want to use.
Example:
JUNCTIONIDLIST(Case.ContactId)
This formula returns the case’s contact record ID. When used on the email action for cases, you can
use this formula as a predefined value for the To Recipients field. Using this formula as a predefined
value for the field ensures that sent emails are always associated with a Salesforce record. In the
case feed publisher, users see the contact name instead of the ID or email address.
Tips:
• You can enter IDs only.
• You can use the JUNCTIONLISTID formula with the To Recipients, CC Recipients, and BCC
Recipients fields to send emails to multiple contacts and users. However, these fields work only
with the email action for cases.
LEFT
Description:
Returns the specified number of characters from the beginning of a text string.
Use:
LEFT(text, num_chars) and replace text with the field or expression you want returned;
replace num_chars with the number of characters from the left you want returned.
Example:
TRIM(LEFT(LastName, 5)) & "-" & TRIM(RIGHT(SSN__c, 4))
This formula displays the first five characters of a name and the last four characters of a social security
number separated by a dash. Note that this example uses a text custom field called SSN.
288
Extend Salesforce with Clicks, Not Code
Tips:
Calculate Field Values With Formulas
• Reference auto-number fields as text fields in formulas.
• If the num_chars value is less than zero, Salesforce replaces the value with zero.
LEN
Description:
Returns the number of characters in a specified text string.
Use:
LEN(text) and replace text with the field or expression whose length you want returned.
Example:
LEN(PartNumber__c)
This formula returns the number of characters in a Product Code field.
LINKTO
Description:
Returns a relative URL in the form of a link (href and anchor tags) for a custom s-control or Salesforce
page.
Use:
{!LINKTO(label, target, id, [inputs], [no override]} and replace
label with the text for the link, target with the URL, and id with a reference to the record.
Inputs are optional and can include any additional parameters you want to add to the link. The no
override argument is also optional and defaults to “false.” It applies to targets for standard
Salesforce pages such as $Action.Account.New. Replace no override with “true” when you
want to display a standard Salesforce page regardless of whether you have defined an override for
it elsewhere.
S-Control Example:
New Account S-Control
<html> <body> {!LINKTO("Create a New Account",
$Action.Account.New, $ObjectType.Account)}
</body> </html>
This example allows users to click a link to create a new account. It is useful in account list views or
Web tabs where you want users to create an account directly from that page. Use the $Action global
variable to access the new account page in Salesforce.
New Email Window S-Control
<html>
<body>
{!LINKTO("Email link",
"mailto:support@yourcompany.com?subject=Please%20Help")};
</body>
</html>
This example launches a new email window addressed to support@yourcompany.com with the
subject “Please Help” whenever a user clicks “Mail link.”
289
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Link to Another S-Control
<html>
<body>
{!LINKTO("Check for duplicates",
$Scontrol.dedup_account, Account.Id)}
</body>
</html>
Use this example to generate a page containing a hyperlink labeled “Check for duplicates.” When
users click this link, Salesforce runs your custom s-control. This example assumes you have already
created a custom s-control to find duplicate accounts and merge their information.
Tips:
• Avoid using this function in an inline s-control if you want it to open in a new window.
• Enclose multiple inputs in brackets to indicate they are together:
{!LINKTO("View Case", $Action.Case.View, Case.Id, [parm1="A",
parm2="B"])}
• Set inputs to null if you do not have any to pass yet you want to set the no override
argument:
{!LINKTO("View Case", $Action.Case.View, Case.Id, null, true)}
• When you override the tab home page for a standard or custom tab, use the tab’s $Action
global variable as the target value, and the tab’s object type for the id value. For example,
LINKTO("Accounts Tab", $Action.Account.Tab,
$ObjectType.Account)
• This function is only available in custom buttons, links, and s-controls.
LN
Description:
Returns the natural logarithm of a specified number. Natural logarithms are based on the constant
e value of 2.71828182845904.
Use:
LN(number) and replace number with the field or expression for which you want the natural
logarithm. Note: the LN function is the inverse of the EXP function.
Example:
LN(10) returns the natural logarithm of 10, which is 2.30.
LN(Value__c) returns the natural logarithm of a custom number field called Value.
LOG
Description:
Returns the base 10 logarithm of a number.
Use:
LOG(number) and replace number with the field or expression from which you want the base
10 logarithm calculated.
290
Extend Salesforce with Clicks, Not Code
Example:
Calculate Field Values With Formulas
Salary
LOG(Salary__c) calculates the logarithm of a person’s salary. In this example, Salary is a
custom currency field.
Hydrogen
-LOG(Hydrogen__c) calculates the pH and acidity using the LOG function and a custom
number field called Hydrogen, which represents the concentration of Hydrogen ions in the liquid
measured in moles per liter.
LOWER
Description:
Converts all letters in the specified text string to lowercase. Any characters that are not letters are
unaffected by this function. Locale rules are applied if a locale is provided.
Use:
LOWER(text, [locale]) and replace text with the field or text you wish to convert to
lowercase, and locale with the optional two-character ISO language code or five-character locale
code, if available.
Example:
MYCOMPANY.COM
LOWER("MYCOMPANY.COM") returns “mycompany.com.”
Ticker Symbol
LOWER(TickerSymbol) returns the text in Ticker Symbol in lower case characters.
Applying Turkish Language Locale Rules
The Turkish language has two versions of the letter “i”: one dotted and one dotless. The locale rules
for Turkish require the ability to capitalize the dotted i, and allow the dotless I to be lowercase. To
correctly use the LOWER() function with the Turkish language locale, use the Turkish locale code
tr in the LOWER() function as follows:
LOWER(text, "tr")
This ensures that Salesforce does not transform any dotted i in the text to a dotless I.
LPAD
Description:
Inserts characters you specify to the left-side of a text string.
Use:
LPAD(text, padded_length[, pad_string]) and replace the variables:
• text is the field or expression you want to insert characters to the left of.
• padded_length is the number of total characters in the text that will be returned.
• pad_string is the character or characters that should be inserted. pad_string is optional
and defaults to a blank space.
If the value in text is longer than pad_string, text is truncated to the size of
padded_length.
291
Extend Salesforce with Clicks, Not Code
Example:
Calculate Field Values With Formulas
Field Name: Padding
LPAD(Name, 20) truncates the Name field after 20 characters. For example, if the name is
mycompany.com, the value returned is "mycompany.com."
My_Company: No Change
LPAD('my_company.com', 14, 'z') returns “my_company.com” without change
because it has 14 characters.
Field Name Padded with Z
LPAD(Name, 15, 'z') returns the name “zmycompany.com.”
Field Name: Truncating
LPAD(Name, 2) truncates the name after the second character. For example, if the name is
mycompany.com, the value returned is “my.”
Tips:
Leading blank spaces and zeros are omitted.
MAX
Description:
Returns the highest number from a list of numbers.
Use:
MAX(number, number,...) and replace number with the fields or expressions from which
you want to retrieve the highest number.
Example:
Service Charge
MAX(0.06 * Total_Cost__c, Min_Service_Charge__c)
In this example, the formula field calculates a service charge of 6% of the total cost or a minimum
service charge, whichever is greater. Note that Min Service Charge is a custom currency
field with a default value of $15. However, you could make it a formula field if your minimum service
charge is always the same amount.
Book Royalties
MAX(0.10 * Pages__c,
(Retail_Price__c * 0.07) * Total_Sold__c)
This formula determines which amount to pay in royalties for a book. It displays the greater of two
amounts: $0.07 for each book sold or $0.10 per page. It assumes you have custom number fields
for Pages and Total Sold and a custom currency field for Retail Price.
Commissions
MAX($User.Commission_Percent__c * Price,
Price * Account_Discount__c, 100)
This formula determines what commission to log for an asset based on which is greater: the user's
commission percentage of the price, the price times the discount percent stored for the account or
100 dollars. This example assumes you have two custom percent fields on users and assets.
292
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
MID
Description:
Returns the specified number of characters from the middle of a text string given the starting position.
Use:
MID(text, start_num, num_chars) and replace text with the field or expression
to use when returning characters; replace start_num with the number of characters from the
left to use as a starting position; replace num_chars with the total number of characters to return.
Example:
MID(Division, 3, 4) returns four characters of the Division name beginning with
the third character from the left. On a user record, this represents the department code.
MIN
Description:
Returns the lowest number from a list of numbers.
Use:
MIN(number, number,...) and replace number with the fields or expressions from which
you want to retrieve the lowest number.
Example:
401K Matching
MIN(250, Contribution__c /2)
This example formula determines which amount to provide in employee 401K matching based on
a matching program of half of the employee's contribution or $250, whichever is less. It assumes
you have custom currency field for Contribution.
Bonus
MIN(Gross__c * Bonus_Percent__c,
Performance__c / Number_of_Employees__c)
This example determines an employee's bonus amount based on the smallest of two amounts: the
employee's gross times bonus percent or an equally divided amount of the company's performance
amount among all employees. It assumes you have custom number field for Number of
Employees, a custom percent field for Bonus Percent, and currency custom fields for the
employee's Gross and company's Performance.
MOD
Description:
Returns a remainder after a number is divided by a specified divisor.
Use:
MOD(number, divisor) and replace number with the field or expression you want divided;
replace divisor with the number to use as the divisor.
Example:
MOD(3, 3) returns 0
MOD(4, 3) returns 1
MOD(123, 100) returns 23
293
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
You might want to prevent users from scheduling meetings on a Saturday or Sunday. Use the
following example to apply a validation rule to a custom date field called My Date.
CASE(MOD(My_Date__c - DATE(1900, 1, 7), 7),
0, 0,
6, 0,
1) = 0
This example displays the following error message when the value of My Date is not Monday
through Friday: “My Date is not a weekday.”
MONTH
Description:
Returns the month, a number between 1 (January) and 12 (December) in number format of a given
date.
Use:
MONTH(date) and replace date with the field or expression for the date containing the month
you want returned.
Example:
SLA Expiration
MONTH(SLAExpirationDate__c) returns the month that your service-level agreement
expires. This example uses a custom date field called SLA Expiration Date.
Current Month
MONTH(TODAY()) returns the current month in a number format. For example, the month of
February would be the value “2.”
NOT
Description:
Returns FALSE for TRUE and TRUE for FALSE.
Use:
NOT(logical) and replace logical with the expression that you want evaluated.
Example:
IF(NOT(ISPICKVAL(Status, "Closed")), ROUND(NOW()-CreatedDate,
0), null checks to see if a variable is open and if so, calculates the number of days it has been
open by subtracting the date and time created from the current date and time. The result is the
number of days open rounded to zero decimal places. If the variable is not open, this field is blank.
NOW
Description:
Returns a date/time representing the current moment.
Use:
NOW()
Example:
IF(ISPICKVAL(Status, "Open"), ROUND(NOW()-CreatedDate, 0), null)
This formula checks to see if a lead is open and if so, calculates the number of days it has been open
by subtracting the date and time created from the current date and time. The result is the number
of days open rounded to zero decimal places. If the lead is not open, this field is blank.
294
Extend Salesforce with Clicks, Not Code
Tips:
Calculate Field Values With Formulas
• Do not remove the parentheses.
• Keep the parentheses empty. They do not need to contain a value.
• Use a date/time field in a NOW function instead of a date field. Created Date and Last
Modified Date are date/time fields whereas Last Activity Date is a date field.
• Use TODAY if you prefer to use a date field.
• Dates and times are always calculated using the user’s time zone.
• Use addition and subtraction operators with a NOW function and other date/time fields to return
a number, representing number of days. For example NOW() - CreatedDate calculates
the number of days since the created date of a record. In this example, the formula field data
type is a number.
• Use addition and subtraction operators with a NOW function and numbers to return a date and
time. For example NOW() +5 calculates the date and time five days ahead of now. In this
example, the formula field data type is a date/time.
NULLVALUE
Important: Use BLANKVALUE instead of NULLVALUE in new formulas. BLANKVALUE has the same functionality as NULLVALUE,
but also supports text fields. Salesforce will continue to support NULLVALUE, so you do not need to change existing formulas.
Description:
Determines if an expression is null (blank) and returns a substitute expression if it is. If the expression
is not blank, returns the value of the expression.
Use:
NULLVALUE(expression, substitute_expression) and replace expression
with the expression you want to evaluate; replace substitute_expression with the value
you want to replace any blank values.
Example:
(NULLVALUE(Sample_Due_Date__c, StartDate +5)
This formula returns the date five days after the start date whenever Sample Due Date is
blank. Sample Due Date is a custom date field.
Tips:
• Avoid using this function with text fields because they are never null even when they are blank.
Instead, use the BLANKVALUE function to determine if a text field is blank.
• Don’t use NULLVALUE for date/time fields.
• Choose Treat blank fields as blanks for your formula when referencing a
number, percent, or currency field in a NULLVALUE function. Choosing Treat blank
fields as zeroes gives blank fields the value of zero so none of them will be null.
• Use the same data type for both the expression and substitute_expression.
OR
Description:
Determines if expressions are true or false. Returns TRUE if any expression is true. Returns FALSE if
all expressions are false. Use this function as an alternative to the operator || (OR).
295
Extend Salesforce with Clicks, Not Code
Use:
Calculate Field Values With Formulas
OR(logical1, logical2...) and replace any number of logical references with the
expressions you want evaluated.
Formula Field Example:
IF(OR(ISPICKVAL(Priority, "High"), ISPICKVAL(Status, "New")),
ROUND(NOW()-CreatedDate, 0), null)
This formula returns the number of days a case has been open if the Status is new or the
Priority is high. If the case was opened today, this field displays a zero.
Validation Rule Example:
OR(Sample_Rate__c < 0, Sample_Rate__c > 0.40)
This validation rule formula displays the following error message when the Sample Rate custom
field is not between 0 and 40%: “SampleRate cannot exceed 40%.”
PARENTGROUPVAL
Description:
This function returns the value of a specified parent grouping. A “parent” grouping is any level above
the one containing the formula. You can only use this function in custom summary formulas for
reports.
Use:
Summary and Joined: PARENTGROUPVAL(summary_field, grouping_level)
Matrix: PARENTGROUPVAL(summary_field, parent_row_grouping,
parent_column_grouping)
Where summary_field is the summarized field value, grouping_level is the parent level
for summary reports, and parent_row_level and parent_column_level are the
parent levels for matrix reports.
Example:
TOTAL_PRICE:SUM/PARENTGROUPVAL(TOTAL_PRICE:SUM, GRAND_SUMMARY)
This formula calculates, for each product, its relative size compared to the grand total. In this example,
the report is a summary of opportunities and their products, grouped by Product Name.
PREVGROUPVAL
Description:
Use:
This function returns the value of a specified previous grouping. A “previous” grouping is one that
comes before the current grouping in the report. Choose the grouping level and increment. The
increment is the number of columns or rows before the current summary. The default is 1; the
maximum is 12. You can only use this function in custom summary formulas for reports.
PREVGROUPVAL(summary_field, grouping_level [, increment])
Where summary_field is the name of the grouped row or column, grouping_level is
the summary level, and increment is the number of rows or columns previous.
Example:
AMOUNT:SUM - PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE)
296
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
This formula calculates, for each month, the difference in amount from the previous month shown
in the report. In this example, the report is an opportunity matrix with columns grouped by Close
Date and rows by Stage.
PRIORVALUE
Description:
Returns the previous value of a field.
Use:
PRIORVALUE(field)
Validation Rule Example:
The following validation rule prevents users from changing the expected revenue of an opportunity
after it is closed: AND(PRIORVALUE(Amount) > Amount, IsClosed).
Tips:
• This function is available only in:
– Assignment rules
– Validation rules
– Field updates
– Workflow rules if the evaluation criteria is set to Evaluate the rule when a
record is: created, and every time it’s edited .
– Formula criteria for executing actions in the Process Builder.
• This function does not return default values.
• When users create a new record, this function returns the value of the field referenced rather
than null. For example, if you create an account named “Acme,”
PRIORVALUE(Account.Name) returns Acme.
• When using the ISPICKVAL function to return the previous value of a picklist field, include the
PRIORVALUE function inside the ISPICKVAL function as in this example:
ISPICKVAL(PRIORVALUE
(picklist_field),
text_literal)
• Use the PRIORVALUE function inside the INCLUDES function to check if the previous value of a
multi-select picklist field included a specific value. For example:
INCLUDES(
PRIORVALUE(multiselect_picklist_field),
text_literal
)
REGEX
Description:
Compares a text field to a regular expression and returns TRUE if there is a match. Otherwise, it
returns FALSE. A regular expression is a string used to describe a format of a string according to
certain syntax rules.
297
Extend Salesforce with Clicks, Not Code
Use:
Calculate Field Values With Formulas
REGEX(text, regex_text) and replace text with the text field, and regex_text
with the regular expression you want to match.
Validation Rule Example:
This example ensures that a custom field called SSN matches a regular expression representing a
valid social security number format of the form 999-99-9999.
NOT(
OR(
LEN (SSN__c) = 0,
REGEX(SSN__c, "[0-9]{3}-[0-9]{2}-[0-9]{4}")
)
)
Tips:
• Regular expression syntax is based on Java Platform SE 6 syntax. However, backslash characters
(\) must be changed to double backslashes (\\) because backslash is an escape character in
Salesforce.
• The Salesforce regular expression engine matches an entire string as opposed to searching for
a match within a string. For example, if you are searching for the name Marc Benioff, use the
regular expression, .*Marc Benioff.*, to find a match in a string like the following:
According to Marc Benioff, the social enterprise increases
customer success.
If you use the regular expression, Marc Benioff, the only string that this regular expression
will match is:
Marc Benioff
• Capture groups and substitutions are ignored.
• This function is available everywhere formulas exist except formula fields and custom buttons
and links.
REQUIRESCRIPT
Description:
Returns a script tag with source for a URL you specify. Use this function when referencing the
Force.com AJAX Toolkit or other JavaScript toolkits.
Use:
{!REQUIRESCRIPT(url)} and replace url with the link for the script that is required.
For the AJAX Toolkit:
{!requireScript("/soap/ajax/13.0/connection.js")}
Returns:
<script src="/soap/ajax/13.0/connection.js"></script>
Custom Button Example:
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var c = new sforce.SObject("Case");
c.id = "{!Case.Id}";
298
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
c.Status = "New";
result = sforce.connection.update([c]);
window.location.reload();
This example sets the Status of a case to “New” whenever a user clicks a custom button from
the case detail page. To set this up in your organization, define a custom button for cases that has
the following attributes:
• Display Type is “Detail Page Button”
• Behavior is “Execute JavaScript”
• Content Source is “OnClick JavaScript”
Next, paste the content above into your custom button definition and add it to your case page
layouts.
Tips:
• Use global variables to access special merge fields for s-controls.
• Use this function when creating custom buttons or links where you have set Behavior to
“Execute JavaScript” and Content Source to “OnClick JavaScript” because the script tag
must be outside the OnClick code.
• This function is only available for custom buttons and links that have Content Source set
to “OnClick JavaScript.”
• When working in Visualforce, use INCLUDESCRIPT instead.
RIGHT
Description:
Returns the specified number of characters from the end of a text string.
Use:
RIGHT(text, num_chars) and replace text with the field or expression you want returned;
replace num_chars with the number of characters from the right you want returned.
Example:
TRIM(LEFT(LastName, 5))&"-"&TRIM(RIGHT(SSN__c, 4)) displays the first five
characters of a name and the last four characters of a social security number separated by a dash.
Note that this assumes you have a text custom field called SSN.
Tips:
• Reference auto-number fields as text fields in formulas.
• If the num_chars value is less than zero, Salesforce replaces the value with zero.
ROUND
Description:
Returns the nearest number to a number you specify, constraining the new number by a specified
number of digits.
Use:
ROUND(number, num_digits) and replace number with the field or expression you want
rounded; replace num_digits with the number of decimal places you want to consider when
rounding.
299
Extend Salesforce with Clicks, Not Code
Example:
Calculate Field Values With Formulas
ROUND (1.5, 0) = 2
ROUND (1.2345, 0) = 1
ROUND (-1.5, 0) = -2
ROUND (225.49823, 2) = 225.50
Simple Discounting
ROUND(Amount-Amount* Discount_Percent__c,2)
Use this formula to calculate the discounted amount of an opportunity rounded off to two digits.
This example is a number formula field on opportunities that uses a custom percent field called
Discount Percent.
Tips:
• Enter zero for num_digits to round a number to the nearest integer.
• Salesforce automatically rounds numbers based on the decimal places you specify. For example,
a custom number field with two decimal places stores 1.50 when you enter 1.49999.
• Salesforce uses the round half-up rounding algorithm. Half-way values are always rounded up.
For example, 1.45 is rounded to 1.5. –1.45 is rounded to –1.5.
• The decimal numbers displayed depend on the decimal places you selected when defining the
field in the custom field wizard. The num_digits represents the number of digits considered
when rounding.
RPAD
Description:
Inserts characters that you specify to the right-side of a text string.
Use:
RPAD(text, padded_length[, 'pad_string']) and replace the variables:
• text is the field or expression after which you want to insert characters.
• pad_length is the number of total characters in the text string that will be returned.
• pad_string is the character or characters to insert. pad_string is optional and defaults
to a blank space.
If the value in text is longer than pad_string, text is truncated to the size of
padded_length.
Example:
Field Name: Padding Default
RPAD(Name, 20) truncates the Name field after 20 characters. For example, if the name is
mycompany.com, the value returned is “mycompany.com.”
My_Company: No Change
RPAD('my_company.com', 14, 'z') returns “my_company.com” without change
because it has 14 characters.
Field Name: Padding with a Character
RPAD(Name, 15, 'z') returns “mycompany.comz” .
Field Name: Truncating
300
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
RPAD(Name, 2) truncates the name after the second character. For example, if the name is
mycompany.com, the value returned is “my.”
Tips:
Ending blank spaces are omitted.
SQRT
Description:
Returns the positive square root of a given number.
Use:
SQRT(number) and replace number with the field or expression you want computed into a
square root.
Example:
SQRT(25)returns the square root of 25, which is 5.
Amplitude
SQRT(Amplitude__c) returns the square root of a custom number field representing the
amplitude of an earthquake.
Tips:
• Calculating the square root of a negative number results in an error on the detail page.
• Avoid division by zero errors by including an IF function such as: IF(Amplitude__c >=
0, SQRT(Amplitude__c), null).
SUBSTITUTE
Description:
Substitutes new text for old text in a text string.
Use:
SUBSTITUTE(text, old_text, new_text) and replace text with the field or value
for which you want to substitute values, old_text with the text you want replaced, and
new_text with the text you want to replace the old_text.
Example:
SUBSTITUTE(Name, "Coupon", "Discount")returns the name of an opportunity that
contains the term “Coupon” with the opportunity name plus “Discount” wherever the term “Coupon”
existed.
SUBSTITUTE(Email, LEFT(Email, FIND("@", Email)), "www.") finds the
location of the @ sign in a person's email address to determine the length of text to replace with a
“www.” as a means of deriving their website address.
Tips:
• Each term provided in quotes is case-sensitive.
• If the old_text appears more than once, each occurrence is replaced with the new_text
value provided, even when that results in duplicates.
TEXT
Description:
Converts a percent, number, date, date/time, or currency type field into text anywhere formulas are
used. Also, converts picklist values to text in approval rules, approval step rules, workflow rules,
301
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
escalation rules, assignment rules, auto-response rules, validation rules, formula fields, field updates,
and custom buttons and links.
Use:
TEXT(value) and replace value with the field or expression you want to convert to text
format. Avoid using any special characters besides a decimal point (period) or minus sign (dash) in
this function.
Example:
Expected Revenue in Text
TEXT(ExpectedRevenue) returns the expected revenue amount of an opportunity in text
format without a dollar sign. For example, if the Expected Revenue of a campaign is "$200,000,"
this formula field displays “200000.”
Asset ID
SerialNumber &"-"& TEXT(Quantity) returns an asset ID number starting with the
serial number and ending with the quantity separated by a dash. The Serial Number field is
already text but the Quantity field is a number, requiring the TEXT function before it.
Use Picklist Values in Math Equations
VALUE(LEFT(TEXT(Quantity), 5)) * Unit
This formula multiplies the first five numbers of the Quantity picklist by the Unit numeric
field.
Compare Two Picklists
IF(TEXT(bug_status) = TEXT(case_status), “Match”, “Out of Sync”)
This formula compares the values of the bug_status picklist with values of the case_status
picklist.
Display Picklist Values From Parent Records
TEXT(Account.Industry)
This formula field on opportunities shows the industry of the associated account.
Concatenate Picklist Values
TEXT(Account.Industry) & " - " & TEXT(Account.SubIndustry__c)
This formula field on opportunities shows the industry and subindustry of the associated account.
Validation Rule Examples:
Block the Save of a Closed Opportunity
CONTAINS(TEXT(Status), "Closed") returns TRUE if the Status picklist contains
the value “Closed,” such as “Closed Won” and “Closed Lost.” This validation rule formula blocks users
from saving changes to a closed opportunity.
Use Numeric Functions on Numeric Picklist Values
VALUE(LEFT(TEXT(Quantity), 5)) * Unit > 10000 multiplies the first five
numbers of the Quantity picklist by the Unit numeric field, and returns TRUE if the result is
greater than 10,000.
Directly Compare Two Picklists
TEXT(bug_status) = TEXT(case_status) compares the values of the bug_status
picklist with values of the case_status picklist, and returns TRUE if they are equal.
302
Extend Salesforce with Clicks, Not Code
Tips:
Calculate Field Values With Formulas
• The returned text is not formatted with any currency, percent symbols, or commas.
• Values are not sensitive to locale. For example, 24.42 EUR is converted into the number 24.42.
• Percents are returned in the form of a decimal.
• Dates are returned in the form of YYYY-MM-DD, that is, a four-digit year and two-digit month
and day.
• Date/time values are returned in the form of YYYY-MM-DD HH:MM:SSZ where YYYY is a four-digit
year, MM is a two-digit month, DD is a two-digit day, HH is the two-digit hour, MM are the
minutes, SS are the seconds, and Z represents the zero meridian indicating the time is returned
in UTC time zone.
• Picklist fields are supported in TEXT functions used in these kinds of formulas: validation rules,
approval rules, approval step rules, workflow rules, escalation rules, assignment rules,
auto-response rules, formula fields, field updates, and custom buttons and links. In other formulas,
use ISPICKVAL or CASE when referencing a picklist field.
TODAY
Description:
Returns the current date as a date data type.
Use:
TODAY()
Example:
TODAY()-Sample_date_c calculates how many days in the sample are left.
Validation Rule Example:
SampleDate < TODAY()
This example ensures that users cannot change the Sample Date to any date in the past.
Tips:
• Do not remove the parentheses.
• Keep the parentheses empty. They do not need to contain a value.
• Use a date field with a TODAY function instead of a date/time field. Last Activity Date
is a date field whereas Created Date and Last Modified Date are date/time fields.
• See NOW if you prefer to use a date/time field.
• Dates and times are always calculated using the user’s time zone.
• Use addition and subtraction operators with a TODAY function and other date fields to return
a number, representing number of days. For example TODAY()-LastActivityDate
calculates the number of days since the last activity date. In this example, the formula field data
type is a number.
• Use addition and subtraction operators with a TODAY function and numbers to return a date.
For example TODAY() +5 calculates the date five days ahead of today. In this example, the
formula field data type is a date.
TRIM
Description:
Removes the spaces and tabs from the beginning and end of a text string.
303
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Use:
TRIM(text) and replace text with the field or expression you want to trim.
Example:
TRIM(LEFT(LastName,5))& "-" & RIGHT(FirstName, 1) returns a network ID
for users that contains the first five characters of their last name and first character of their first name
separated by a dash.
UPPER
Description:
Converts all letters in the specified text string to uppercase. Any characters that are not letters are
unaffected by this function. Locale rules are applied if a locale is provided.
Use:
UPPER(text, [locale]) and replace text with the field or expression you wish to convert
to uppercase, and locale with the optional two-character ISO language code or five-character
locale code, if available.
Example:
MYCOMPANY.COM
UPPER("mycompany.com") returns “MYCOMPANY.COM.”
MYCOMPANY.COM 123
UPPER("Mycompany.com 123") returns “MYCOMPANY.COM 123.”
Applying Turkish Language Locale Rules
The Turkish language has two versions of the letter i: one dotted and one dotless. The locale rules
for Turkish require the ability to capitalize the dotted i, and allow the dotless I to be lowercase. To
correctly use the UPPER() function with the Turkish language locale, use the Turkish locale code
tr in the UPPER() function as follows:
UPPER(text, "tr")
This ensures that any dotted i in the text does not transform to a dotless I.
URLENCODE
Description:
Encodes text and merge field values for use in URLs by replacing characters that are illegal in URLs,
such as blank spaces, with the code that represent those characters as defined in RFC 3986, Uniform
Resource Identifier (URI): Generic Syntax. For example, blank spaces are replaced with %20, and
exclamation points are replaced with %21.
Use:
{!URLENCODE(text)} and replace text with the merge field or text string that you want
to encode.
Example:
If the merge field foo__c contains <B>Mark's page<b>, {!URLENCODE(foo_c)}
results in: %3CB%3EMark%27s%20page%3C%2Fb%3E
Tips:
• This function is only available in custom buttons and links, and in Visualforce.
• Custom buttons and links with URL content sources have separate encoding settings. If you use
the URLENCODE function to encode a custom button or link that has an encoding setting
specified, Salesforce first encodes the URL according to the custom button or link setting, then
encodes the result. For example, if the URL in a custom link contains a space and its encoding
304
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
setting is UTF8, Salesforce first encodes the space to a plus sign (+), then the URLENCODE
function converts the plus sign to its character code, %2B.
• When you include the standard Account field on opportunities (Opportunity.Account)
in the URLENCODE function, the value of the field is the account ID, not the account name. To
encode the account name, create a custom cross-object formula field on opportunities that
spans to the account name, and use that field in the URLENCODE function instead of
Opportunity.Account. For example, if the cross-object formula is
AccountNameFormula__c, use the following:
http://www.google.com/search?q={!URLENCODE
(Opportunity.AccountNameFormula__c)}
URLFOR
Description:
Returns a relative URL for an action, s-control, Visualforce page, or a file in a static resource archive
in a Visualforce page.
Use:
{!URLFOR(target, [id], [inputs], [no override])} and replace target
with the URL or action, s-control, or static resource merge variable, id with an optional reference
to the record, and inputs with any optional parameters. The no override argument is also
optional and defaults to “false.” It applies to targets for standard Salesforce pages such as
$Action.Account.New. Replace no override with “true” when you want to display a standard
Salesforce page regardless of whether you have defined an override for it elsewhere.
The input values can be dynamic. For example, to include an account ID, specify:
{!URLFOR($Page.myVisualforcePage, null, [accountId=Account.Id])}
The resulting URL includes a parameter with the ID, such as:
https://instance.salesforce.com/apex/myVisualforcePage?accountId=001B0000002txol
You can also use non-string variables, like an SObject variable. For example, if you supply
[myAccountParam=Account], the value is converted to a string, and the URL contains
?MyAccountParam=001B0000002txol. You can also use a parameter to supply a static
value, such as [param1=55].
Note: Because parameter names are static, you can’t use a variable to determine the
parameter name. For example, if you use [myVariable=”value”] and set
myVariable to “param1”, the resulting URL includes ?myVariable=value1 and
not the param1 value.
Visualforce Example:
<apex:image url="{!URLFOR($Resource.TestZip,
'images/Bluehills.jpg')}" width="50"
height="50"/>
In this example, the <apex:image> component references a .jpg file contained within a .zip file
that has been uploaded as a static resource. When uploaded, the name of the static resource was
defined as TestZip, and the path to the image within the resource is
images/Bluehills.jpg.
305
Extend Salesforce with Clicks, Not Code
Tips:
Calculate Field Values With Formulas
• Use global variables to access special merge fields for actions, s-controls, and static resources.
• If an input parameter name begins with any character other than a letter or dollar sign ($),
enclose it in quotation marks.
• Enclose multiple inputs in brackets to indicate they are together:
{!URLFOR($Action.Case.View, Case.Id, [param1="A", param2="B"])}
• Set inputs to null if you do not have any to pass yet you want to set the no override
argument:
{!URLFOR($Action.Case.View, Case.Id, null, true)}
• When you override a standard action, that action is no longer available in Salesforce. For example,
if you override the new account action, that affects the New button on all pages, such as the
account detail page, account related lists on other detail pages, and the Create New dropdown
list in the sidebar. To override a standard action yet still access it, use the no override
argument in your s-control to reference that action.
• When you override the tab home page for a standard or custom tab, use the tab’s $Action
global variable as the target value, and the tab’s object type for the id value. For example,
URLFOR($Action.Account.Tab, $ObjectType.Account).
• This function is only available in custom buttons, links, s-controls, and Visualforce pages.
VALUE
Description:
Converts a text string to a number.
Use:
VALUE(text) and replace text with the field or expression you want converted into a number.
Example:
Lead Number
VALUE(Lead_Number__c) returns a number for the text value in the auto-number field Lead
Number. This can be useful if you want to use the Lead Number field in a calculation. Note
that auto-number fields are actually text fields and must be converted to a number for numeric
calculations.
Round Robin Lead Assignment
MOD(VALUE(Lead_Number__c), 3)
This formula is for a custom formula field named Round_Robin_ID that assigns each lead a value
of 0, 1, or 2. This formula uses a custom auto-number field called Lead Number that assigns
each lead a unique number starting with 1. The MOD function divides the lead number by the
number of lead queues available (three in this example) and returns a remainder of 0, 1, or 2. Use
the value of this formula field in your lead assignment rules to assign lead records to different queues.
For example:
• Round_Robin_ID = 0 is assigned to Queue A
• Round_Robin_ID = 1 is assigned to Queue B
• Round_Robin_ID = 2 is assigned to Queue C
306
Extend Salesforce with Clicks, Not Code
Tips:
Calculate Field Values With Formulas
Make sure the text in a VALUE function does not include any special characters other than a decimal
point (period) or minus sign (dash). For example, the formula VALUE(Text_field__c)
produces these results:
• If Text field is 123, the result is 123
• If Text field is blank, the result is #Error!
• If Text field is $123, the result is #Error!
• If Text field is EUR123, the result is #Error!
VLOOKUP
Description:
Returns a value by looking up a related value on a custom object similar to the VLOOKUP() Excel
function.
Use:
VLOOKUP(field_to_return, field_on_lookup_object, lookup_value)
and replace field_to_return with the field that contains the value you want returned,
field_on_lookup_object with the field on the related object that contains the value you
want to match, and lookup_value with the value you want to match.
Validation Rule Example:
This example checks that a billing postal code is valid by looking up the first five characters of the
value in a custom object called Zip_Code__c that contains a record for every valid zip code in the
US. If the zip code is not found in the Zip_Code__c object or the billing state does not match the
corresponding State_Code__c in the Zip_Code__c object, an error is displayed.
AND( LEN(BillingPostalCode) > 0, OR(BillingCountry = "USA",
BillingCountry = "US"),
VLOOKUP(
$ObjectType.Zip_Code__c.Fields.State_Code__c,
$ObjectType.Zip_Code__c.Fields.Name, LEFT(BillingPostalCode,5))
<>
BillingState )
Note:
• Use this example when the billing country is US or USA.
• You can download US zip codes in CSV file format from http://zips.sourceforge.net.
Tips:
• The field_to_return must be an auto number, roll-up summary, lookup relationship,
master-detail relationship, checkbox, date, date/time, email, number, percent, phone, text, text
area, or URL field type.
• The field_on_lookup_object must be the Record Name field on a custom object.
• The field_on_lookup_object and lookup_value must be the same data type.
• If more than one record matches, the value from the first record is returned.
• The value returned must be on a custom object.
• You cannot delete the custom field or custom object referenced in this function.
• This function is only available in validation rules.
307
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
YEAR
Description:
Returns the four-digit year in number format of a given date.
Use:
YEAR(date) and replace date with the field or expression that contains the year you want
returned.
Example:
YEAR(TODAY())- YEAR(Initial_Meeting__c) returns the number of years since
your initial meeting with a client. This example uses a custom date field called Initial Meeting.
SEE ALSO:
Formula Operators and Functions A–H
Formula Operators and Functions
Using Date and Date/Time Values in Formulas
Date formulas are useful for managing payment deadlines, contract ages, or any other features of
your organization that are time or date dependent.
EDITIONS
Two data types are used for working with dates: Date and Date/Time. Most values that are used
when working with dates are of the Date data type, which store the year, month, and day. Some
fields, such as CreatedDate, are Date/Time fields, meaning they not only store a date value,
but also a time value (stored in GMT but displayed in the users’ time zone). Date and Date/Time
fields are formatted in the user’s locale when viewed in reports and record detail pages.
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
You can use operations like addition and subtraction on Date and Date/Time values to calculate a
future date or elapsed time between two dates. If you subtract one date from another, for example, the resulting value will be the
difference between the two initial values in days (Number data type). The same operation between two Date/Time values returns a
decimal value indicating the difference in number of days, hours, and minutes.
For example, if the difference between two Date/Time values is 5.52, that means the two values are separated by five days, 12 hours (0.5
of a day), and 28 minutes (0.02 of a day). You can also add numeric values to Dates and Date/Times. For example, the operation TODAY()
+ 3 returns three days after today’s date. For more information and examples of working with dates, see the list of Sample Date
Formulas.
Throughout the examples, the variables date and date/time are used in place of actual Date and Date/Time fields or values.
Keep in mind that complex date functions tend to compile to a larger size than text or number formula functions, so you might run into
issues with formula compile size. See Tips for Reducing Formula Size for help with this problem.
TODAY() and NOW()
The TODAY() function returns the current day, month, and year as a Date data type. This function is useful for formulas where you are
concerned with how many days have passed since a previous date, the date of a certain number of days in the future, or if you just want
to display the current date.
The NOW() function returns the Date/Time value of the current moment. It’s useful when you are concerned with specific times of day
as well as the date.
For details on how to convert between Date values and Date/Time values, see Converting Between Date/Time and Date.
308
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
The DATE() Function
The DATE() function returns a Date value, given a year, month, and day. Numerical Y/M/D values and the YEAR(), MONTH(), and
DAY() functions are valid parameters for DATE(). For example DATE( 2013, 6, 1 ) returns June 6, 2013. Similarly, DATE(
YEAR( TODAY() ), MONTH( TODAY() ) + 3, 1) returns the Date value of the first day three months from today in the
current year, assuming the date is valid (for example, the month falls between 1 and 12).
If the inputted Y/M/D values result in an invalid date, the DATE() function returns an error, so error checking is an important part of
working with Date values. You can read about methods for handling invalid dates in Sample Date Formulas.
Converting Between Date/Time and Date
Date and Date/Time aren’t interchangeable data types, so when you want to perform operations between Date and Date/Time values,
you need to convert the values so they are both the same type. Some functions (such as YEAR(), MONTH(), and DAY()) also only
work on Date values, so Date/Time values must be converted first.
Use the DATEVALUE( date/time ) function to return the Date value of a Date/Time. For example, to get the year from a
Date/Time, use YEAR( DATEVALUE( date/time ) ) ).
You can convert a Date value to a Date/Time using the DATETIMEVALUE( date ) function. The time will be set to 12:00 a.m. in
Greenwich Mean Time (GMT), and then converted to the time zone of the user viewing the record when it’s displayed. For a user located
in San Francisco, DATETIMEVALUE( TODAY() ) returns 5:00 p.m. on the previous day (during Daylight Saving Time) rather than
12:00 a.m. of the current day. See A Note About Date/Time and Time Zones for more information.
Converting Between Date and Text
If you want to include a date as part of a string, wrap the Date value in the TEXT() function to convert it to text. For example, if you
want to return today’s date as text, use:
"Today's date is " & TEXT( TODAY() )
This returns the date in the format “YYYY-MM-DD” rather than in the locale-dependent format. You can change the format by extracting
the day, month, and year from the date first and then recombining them in the format you want. For example:
"Today's date is " & TEXT( MONTH( date ) ) & "/" & TEXT( DAY( date ) ) & "/" & TEXT( YEAR(
date ) ) )
You can also convert text to a Date so you can use the string value with your other Date fields and formulas. You’ll want your text to be
formatted as “YYYY-MM-DD”. Use this formula to return the Date value:
DATEVALUE( "YYYY-MM-DD" )
Converting Between Date/Time and Text
You can include Date/Time values in a string using the TEXT() function, but you need to be careful of time zones. For example,
consider this formula:
"The current date and time is " & TEXT( NOW() )
In this formula, NOW() is offset to GMT. Normally, NOW() would be converted to the user’s time zone when viewed, but because it’s
been converted to text, the conversion won’t happen. So if you execute this formula on August 1st at 5:00 PM in San Francisco time
(GMT-7), the result is “The current date and time is 2013–08–02 00:00:00Z”.
309
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
When you convert a Date/Time to text, a “Z” is included at the end to indicate GMT. TEXT( date/time ) returns “Z” if the field is
blank. So if the Date/Time value you’re working with might be blank, check for this before converting to text:
IF(
ISBLANK( date/time ),
"",
TEXT( date/time )
)
To convert a string to a Date/Time value, use DATETIMEVALUE() passing in a string in the format “YYYY-MM-DD HH:MM:SS”. This
method returns the Date/Time value in GMT.
A Note About Date/Time and Time Zones
Date and Date/Time values are stored in GMT. When a record is saved, field values are adjusted from the user’s time zone to GMT, and
then adjusted back to the viewer’s time zone when displayed in record detail pages and reports. With Date conversions this doesn't
pose a problem, since converting a Date/Time to a Date results in the same Date value.
When working with Date/Time fields and values, however, the conversion is always done in GMT, not the user’s time zone. Subtracting
a standard Date/Time field from another isn’t a problem because both fields are in the same time zone. When one of the values in the
calculation is a conversion from a Text or Date value to a Date/Time value, however, the results are different.
Let’s say a San Francisco user enters a value of 12:00 AM on August 2, 2013 in a custom Date/Time field called Date_Time_c. This
value is stored as 2013–08–02 07:00:00Z, because the time difference in Pacific Daylight Time is GMT-7. At 12:00 p.m. PDT on August
1st, the user views the record and the following formula is run:
Date_Time_c - NOW()
In the calculation, NOW() is 2013–08–01 19:00:00Z, and then subtracted from 2013–08–02 07:00:00Z, to return the expected result of
0.5 (12 hours).
Suppose that instead of NOW(), the formula converts the string “2013–08–01 12:00:00” to a Date/Time value:
Date_Time_c - DATETIMEVALUE( "2013-08-01 12:00:00" )
In this case, DATETIMEVALUE( “2013–08–01 12:00:00” ) is 2013–08–01 12:00:00Z, and returns a result of 0.79167, or
19 hours.
There’s no way to determine a user’s time zone in a formula. If all of your users are in the same time zone, you can adjust the time zone
difference by adding or subtracting the time difference between the users’ time zone and GMT to your converted values. However, since
time zones can be affected by Daylight Saving Time, and the start and end dates for DST are different each year, this is difficult to manage
in a formula. We recommend using Apex for transactions that require converting between Date/Time values and Text or Date values.
SEE ALSO:
Tips for Building Formulas
310
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Build a Formula Field
Your custom formula fields require special attributes.
EDITIONS
Note: The Getting Started with Formulas (Salesforce Classic) help video includes a live demo
of these steps.
1. Begin building a formula field the same way you create a custom field. See Create Custom Fields
on page 133.
2. Select the data type for the formula. Choose the appropriate data type for your formula based
on the output of your calculation. See Formula Data Types on page 254.
3. Choose the number of decimal places for currency, number, or percent data types. This setting
is ignored for currency fields in multicurrency organizations. Instead, the Decimal Places
for your currency setting apply.
Note: Salesforce uses the round half up tie-breaking rule for numbers in formula fields.
For example, 12.345 becomes 12.35 and −12.345 becomes −12.34.
4. Click Next.
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To view formula field details:
• View Setup and
Configuration
To create, change, or delete
formula fields:
• Customize Application
5. Build your formula:
a. If you are building a formula in the Advanced Formula tab or for approvals or rules, such as workflow, validation, assignment,
auto-response, or escalation, click Insert Field, choose a field, and click Insert.
To create a basic formula that passes specific Salesforce data, select the Simple Formula tab, choose the field type in the
Select Field Type drop-down list, and choose one of the fields listed in the Insert Field drop-down list.
Tip: Build cross-object formulas to span to related objects and reference merge fields on those objects.
b. To insert an operator, choose the appropriate operator icon from the Insert Operator drop-down list.
c. Optionally, click the Advanced Formula tab to use functions and view additional operators and merge fields. Functions are
prebuilt formulas that you can customize with your input parameters.
d. To insert a function, double-click its name in the list, or select it and click Insert Selected Function. To filter the list of functions,
choose a category from the Functions drop-down list. Select a function and click Help on this function to view a description
and examples of formulas using that function.
e. Consider adding comments to your formula, especially if it is complicated. Comments must begin with a forward slash followed
by an asterisk (/*), and conclude with an asterisk followed by a forward slash (*/).
Comments are useful for explaining specific parts of a formula to anyone viewing the formula definition. For example:
AND(
/*competitor field is required, check to see if field is empty */
LEN(Competitor__c) = 0,
/* rule only enforced for ABCD record types */
RecordType.Name = "ABCD Value",
/* checking for any closed status, allows for additional closed picklist values in
the future */
CONTAINS(TEXT(StageName), "Closed")
)
You can also use comments to comment out sections of your formula when debugging and checking the syntax to locate errors
in the formula.
311
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Note:
• Nesting comments causes a syntax error. For example, you cannot save a formula that has the following:
/* /* comment */ */
• Commenting out a whole formula causes a syntax error.
• Comments count against the character and byte size limits in formulas.
Note: Formula fields can contain up to 3,900 characters, including spaces, return characters, and comments. If your formula
requires more characters, create separate formula fields and reference them in another formula field. The maximum number
of displayed characters after an evaluation of a formula expression is 1,300.
6. To check your formula for errors, click Check Syntax.
7. Optionally, enter a description of the formula in the Description box.
8. If your formula references any number, currency, or percent fields, choose an option for handling blank fields. To give any blank
fields a zero value, choose Treat blank fields as zeros. To leave these fields blank, choose Treat blank fields
as blanks.
9. Click Next.
10. Set the field-level security to determine whether the field should be visible for specific profiles, and click Next.
11. Choose the page layouts that should display the field. The field is added as the last field in the first two-column section on the page
layout. For user custom fields, the field is automatically added to the bottom of the user detail page.
12. Click Save to finish or Save & New to create more custom fields.
Note: Because formula fields are automatically calculated, they are read-only on record detail pages and do not update last
modified date fields. Formula fields are not visible on edit pages.
In account formulas, all business account fields are available as merge fields. However, account fields exclusive to person accounts
such as Birthdate and Email are not available.
Tips for Building Formulas
What Are Cross-Object Formulas?
SEE ALSO:
Elements of a Formula
Merge Fields for Formulas
Tips for Building Formulas
Formula Operators and Functions
Quick Reference Guide: Formula Fields
312
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Tips for Building Formulas
Watch a Demo:
Formulas: Tips and Gotchas (Salesforce Classic)
• Formula fields that a user can see may reference fields that are hidden or read only using
field-level security. If the formula field contains sensitive information, use field-level security to
hide it.
• You can add activity formula fields to task and event page layouts. Note that a task-related
formula field on an event page layout may not be useful. Likewise, event-related formula fields
on task page layouts may not be useful.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
• To determine if a record is a task or event, use the IsTask merge field. For example:
IF(IsTask, "This is a task", "This is an event")
Tips for Working with Date and Date/Time Formula Fields
Tips for Using Merge Fields in Formulas
Tips for Working with Number Formula Fields
Tips for Working with Picklist and Multi-Select Picklist Formula Fields
Tips for Referencing Record Types in Formulas
Tips for Working with Text Formula Fields
SEE ALSO:
Build a Formula Field
Common Formula Errors
Tips for Working with Date and Date/Time Formula Fields
• Dates and times are always calculated using the user’s time zone.
• Date and date/time fields can’t be used interchangeably. The name alone may not indicate if
a field is a date or date/time. For example, Created Date and Last Modified Date
are date/time fields whereas Last Activity Date is a date field. Use the DATEVALUE
function to convert a date/time field into a date field.
Note: The Created Date and Last Modified Date fields display only the
date, not the date and time.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
• Use addition and subtraction operators with date or date/time fields to calculate duration. For example, subtract a date from another
date to calculate the number of days between the two. Likewise, you can subtract the date/time from another date/time to get the
number of days between the two as a number. See NOW or TODAY for suggested use.
• Use addition and subtraction operators with numbers to return another date or date/time. For example, {!CreatedDate} +
5 calculates the date and time five days after a record’s created date. Note that the expression returns the same data type as the
one given; a date field plus or minus a number returns a date, and a date/time field plus or minus a number returns a date/time.
• When calculating dates using fractions, Salesforce ignores any numbers beyond the decimal. For example:
TODAY() + 0.7 is the same as TODAY() + 0, which is today’s date.
TODAY() + 1.7 is the same asTODAY() + 1, which is tomorrow’s date.
TODAY() + (-1.8) is the same as TODAY() + (-1), which is yesterday’s date.
313
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
• To calculate the value of two fractions first, group them within parentheses. For example:
TODAY() + 0.5 + 0.5 is the same as TODAY() + 0 + 0, which is today’s date.
TODAY() + (0.5+0.5) is the same as TODAY() + 1, which is tomorrow’s date.
• Years can’t be zero and must be between -4713 and 9999.
SEE ALSO:
Tips for Building Formulas
Tips for Using Merge Fields in Formulas
• Delegated administrators need to have access to custom objects to access the objects’ merge
fields from formulas.
EDITIONS
• In account formulas, all business account fields are available as merge fields. However, account
fields exclusive to person accounts such as Birthdate and Email are not available.
• You can’t use formula fields that include related object merge fields in roll-up summary fields.
Available in: both Salesforce
Classic and Lightning
Experience
• Formulas and roll-up summary fields can’t reference fields on external objects.
Available in all editions
• Using RecordType.Id can make your formula less readable; when you do use it, write
in-line comments into the formula to clarify.
• To determine if a record is a task or event, use the IsTask merge field. For example:
IF(IsTask, "This is a task", "This is an event")
• To reference the unique identifier for your Salesforce organization in a formula, insert the $Organization.Id merge field. This
merge field can display anywhere formula fields can except in reports.
• Some merge fields display as radio buttons but function like picklist fields when referenced in a formula.
Use the values “Read,” “Edit,” and “None” in a formula when referencing:
– $UserRole.CaseAccessForAccountOwner
– $UserRole.OpportunityAccessForAccountOwner
– CaseAccessLevel (on Territory)
– OpportunityAccessLevel (on Territory)
Use the values “Read,” “Edit,” and “All” in a formula when referencing:
– AccountAccessLevel (on Territory)
• If you create a contacts formula field that references account merge fields, that field can be included in contact page layouts but
should not be included in person accounts page layouts. The formula field will display a value of #Error on the person accounts
page.
SEE ALSO:
Tips for Building Formulas
314
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Tips for Working with Number Formula Fields
• Use the decimal version of a percent when working with percent fields in formulas. For example,
IF(Probability =1...) for 100% probability or IF(Probability =0.9...)
for 90% probability.
• Reference auto-number fields as text fields in formulas.
• The output of your formula must be less than 19 digits.
• Formulas can contain a mix of numbers, percents, and currencies as in this example:
AnnualRevenue / NumberOfEmployees.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
• Salesforce uses the round half up tie-breaking rule for numbers in formula fields. For example, 12.345 becomes 12.35 and −12.345
becomes −12.34.
SEE ALSO:
Tips for Building Formulas
Tips for Working with Picklist and Multi-Select Picklist Formula Fields
• You can use special picklist fields in your formulas, such as IsEscalated for cases and
IsWon for opportunities.
EDITIONS
• Picklist fields can only be used in these functions:
Available in: both Salesforce
Classic and Lightning
Experience
– ISPICKVAL—Compares the value of a picklist to a single value.
– CASE—Compares the value of a picklist to multiple values.
Available in all editions
– TEXT—Returns a picklist value’s API Name so that you can work with a reference to the
value (even if the displayed value changes) in functions that support text values, such as
CONTAINS. (Available in only flow formula resources, formula fields, validation rules, and workflow field updates.)
• Multi-select picklist fields can only be used in these functions:
– INCLUDES
– ISBLANK
– ISNULL
– ISCHANGED (Only in assignment rules, validation rules, workflow field updates, and workflow rules in which the evaluation
criteria is set to Evaluate the rule when a record is: created, and every time it’s edited )
– PRIORVALUE (Only in assignment rules, validation rules, workflow field updates, and workflow rules in which the evaluation
criteria is set to Evaluate the rule when a record is: created, and every time it’s edited )
SEE ALSO:
Tips for Building Formulas
315
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Tips for Referencing Record Types in Formulas
Reference record types in formulas if you want different workflow rules, validation rules, and lookup
filters to apply to different record types. For example, you can:
EDITIONS
• Create a workflow rule on accounts that emails different teams based on the account record
type the user selects when creating the account.
Available in: both Salesforce
Classic and Lightning
Experience
• Create a validation rule on opportunities that allows only members of the North American sales
team to save opportunities with the Domestic record type.
When possible, use RecordTypeId instead of RecordType.Name to reference a specific
record type. While RecordType.Name makes a formula more readable, you must update the
formula if the name of the record type changes, whereas the ID of a record type never changes.
Also, RecordType.Name requires a cross-object reference to the record type, while
RecordTypeId doesn’t. However, if you are deploying formulas across organizations (for
example, between sandbox and production), use RecordType.Name because IDs are not the
same across organizations.
Available in all editions
Record types available in:
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Avoid using $RecordType in formulas, except in default value formulas. Instead, use the RecordType merge field (for example,
Account.RecordType.Name) or the RecordTypeId field on the object.
SEE ALSO:
Tips for Building Formulas
Tips for Working with Text Formula Fields
• Before using the HYPERLINK function, consider the differences between hyperlinks and custom
links.
– Hyperlink formula fields are just like other custom fields that you can display in list views
and reports.
– Custom links display on detail pages in a predefined section; hyperlink formula fields can
display on a detail page wherever you specify.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
– Using custom links, you can specify display properties such as window position and opening
in a separate popup position; hyperlink formula fields open in a new browser window by
default or you can specify a different target window or frame.
– Your formulas can reference custom links. Before deleting a custom link, make sure it is not referenced in a formula field.
– Hyperlink formula fields that contain relative URLs to Salesforce pages, such as /rpt/reportwizard.jsp, can be added
to list views, reports, and related lists. However, use a complete URL, including the server name and https://, in your hyperlink
formula before adding it to a search layout. Formula fields aren’t available in search result layouts.
• To insert text in your formula field, surround the text with quotation marks. For example, to display “CASE: 123,” use this formula
"CASE: "& CaseNumber__c.
• Use the backslash (\) character before a quote or backslash to insert it as a literal value in your output. For example,
"Trouble\\Case \"Ticket\": " in your formula displays Trouble\Case "Ticket": on detail pages.
SEE ALSO:
Tips for Building Formulas
316
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
What Are Cross-Object Formulas?
Cross-object formulas are formulas that span two related objects and reference merge fields on
those objects. Cross-object formulas can reference merge fields from a master (“parent”) object if
an object is on the detail side of a master-detail relationship. Cross-object formulas also work with
lookup relationships.
You can reference fields from objects that are up to 10 relationships away. Cross-object formulas
are available anywhere formulas are used except when creating default values.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
Note: If you create a formula that references a field on another object and display that
formula in your page layout, users can see the field on the object even if they don’t have
access to that object record. For example, if you create a formula field on the Case object that
references an account field, and display that formula field in the case page layout, users can
see this field even if they don’t have access to the account record.
Building Cross-Object Formulas in the Simple Formula Tab
Build Cross-Object Formulas in the Advanced Formula Tab
Tips for Building Cross-Object Formulas
SEE ALSO:
Build a Formula Field
Building Cross-Object Formulas in the Simple Formula Tab
To create a cross-object formula when building a formula in the Simple Formula tab, enter the
relationship names of the objects to which you are spanning followed by the field you want to
reference. Separate the relationship names of each object and the field with periods.
Example: For example, enter Contact.Account.Name to reference the Account
Name for a contact associated with a case in a formula field on the Case object. Be sure to
use the relationship names of the objects, not the labels. Although the relationship name is
often the same as the object name, it is technically the field name of the relationship field.
To reference the parent account name from Account object, the syntax is Parent.Name,
not Account.Name. When referencing a custom object, add two underscores and the
letter r to its name. For example, Position__r.title__c references the Job Title
field (title__c) on a Position custom object.
Note: If you create a formula that references a field on another object and display that
formula in your page layout, users can see the field on the object even if they don’t
have access to that object record. For example, if you create a formula field on the Case
object that references an account field, and display that formula field in the case page
layout, users can see this field even if they don’t have access to the account record.
SEE ALSO:
Build Cross-Object Formulas in the Advanced Formula Tab
What Are Cross-Object Formulas?
317
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To create or change
cross-object formulas:
• Customize Application
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Build Cross-Object Formulas in the Advanced Formula Tab
To create a cross-object formula when building a formula in the Advanced Formula tab or for
approvals or rules, such as workflow, validation, assignment, auto-response, or escalation rules, click
Insert Field, then click the related object to list its fields. Related objects are denoted by a “>” sign.
Note: If you create a formula that references a field on another object and display that
formula in your page layout, users can see the field on the object even if they don’t have
access to that object record. For example, if you create a formula field on the Case object that
references an account field, and display that formula field in the case page layout, users can
see this field even if they don’t have access to the account record.
Example: The value of the Profile.Name merge field differs depending on the context
of the cross-object formula field that references it. On detail pages, the value is the profile
name, as expected. In list views and reports, the value is the internal value of the associated
profile instead. If you use Profile.Name in a formula, use it within an OR function to
ensure that the formula always returns the intended result. For example:
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
USER PERMISSIONS
To create or change
cross-object formulas:
• Customize Application
IF
(OR
(LastModifiedBy.Profile.Name = "Standard User",
LastModifiedBy.Profile.Name = "PT2"),
"Standard", "Not Standard")
None of the above applies to profile names referenced by the $Profile global variable.
SEE ALSO:
Building Cross-Object Formulas in the Simple Formula Tab
What Are Cross-Object Formulas?
Tips for Building Cross-Object Formulas
• Cross-object formulas that reference currency fields convert the value to the currency of the
record that contains the formula. If the referenced currency field is from a custom setting, the
field value isn’t converted to the record’s currency.
• Salesforce allows a maximum of 10 unique relationships per object in cross-object formulas.
The limit is cumulative across all formula fields, rules, and lookup filters. For example, if two
different formulas on opportunities reference two different fields of an associated account, only
one unique relationship exists (from opportunities to accounts).
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
• You can’t reference cross-object formulas in roll-up summary fields.
• In cross-object formulas, you can’t reference merge fields for objects related to activities. For example, merge fields for contacts and
accounts aren’t available in task and event formulas.
Using the Owner Field
Some objects support different object types for the Owner field, such as a User, Queue, or Calendar. On objects that support this behavior,
when creating a cross-object formula using Owner, you must be explicit about the owner type you’re referencing.
318
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
For example, if you need owner email and you don’t use queues, your formula would be Owner:User.Email. If you do use queues,
your formula could be
IF( ISBLANK( Owner:User.Id ), Owner:Queue.QueueEmail, Owner:User.Email )
Here’s how you would select Owner object fields on a Lead in the Advanced formula tab:
Note:
• Owner references aren’t supported in Visualforce pages. For example, on a page with Case as a controller, you can’t include
{!Case.Owner:User.FirstName}. However, you can include an existing spanning formula on a Visualforce page.
For example, if you have a custom text formula MyFormula__c on a Case with value Owner:User.FirstName, you
can include {!Case.MyFormula__c} on your Visualforce page.
• Owner references aren’t supported on the Queue object. For example, you can't reference Owner:Queue.Owner.Email.
• If your formula has Owner:User.fieldname and Owner:Queue.fieldname, both of these count against the
limit of 10 unique relationships per object in cross-object formulas.
• On objects that don’t support Queues, User is implicit when referencing Owner. Your formula should be Owner.fieldname,
not Owner:User.fieldname.
Using Profile.Name
The value of the Profile.Name merge field differs depending on the context of the cross-object formula field that references it. On
detail pages, the value is the profile name, as expected. In list views and reports, the value is the internal value of the associated profile
instead. If you use Profile.Name in a formula, use it within an OR function to ensure that the formula always returns the intended
result. For example:
IF
(OR
(LastModifiedBy.Profile.Name = "Standard User", LastModifiedBy.Profile.Name =
"PT2"),
"Standard", "Not Standard")
None of the above applies to profile names referenced by the $Profile global variable.
SEE ALSO:
Build Cross-Object Formulas in the Advanced Formula Tab
What Are Cross-Object Formulas?
319
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Formula Field Limits and Restrictions
Before you create formula fields, be aware of their limits and limitations.
EDITIONS
• Formula fields have these limits.
– Character limit—Formula fields can contain up to 3,900 characters, including spaces, return
characters, and comments. If your formula needs more characters, create separate formula
fields and reference them in another formula field.
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
Note: The maximum number of displayed characters after an evaluation of a formula
expression is 1,300.
– Save size limit—Formula fields can’t exceed 4,000 bytes when saved. The save size is different from the number of characters if
you use multi-byte characters in your formula.
– Compile size limit—Formula fields can’t exceed 5,000 bytes when compiled. The compile size is the size of the formula (in bytes)
including all of the fields, values, and formulas it references. There is no direct correlation between the compile size and the
character limit. Some functions, such as TEXT, DATEVALUE, DATETIMEVALUE, and DATE significantly increase the compile size.
Tip: For tips on how to rework your formulas to avoid these limits, see Tips for Reducing Formula Size
• Default value formulas for a record type can only reference fields for that record type. However, formula fields and formulas for
approvals or rules for a record type can reference fields for that record type as well as any records that are related through a lookup
or master-detail relationship. For example, a formula for a validation rule on opportunities can reference merge fields for accounts
and campaigns as well as opportunities, and a formula field on accounts can reference fields for cases.
• You can’t use long text area, encrypted, or Description fields in formulas.
• The value of a field can’t depend on another formula that references it.
• You can’t delete fields referenced in formulas. Remove the field from the formula before deleting it.
• Campaign statistic fields can’t be referenced in formulas for field updates, approval processes, workflow rules, or validation rules,
but can be referenced in custom formula fields.
SEE ALSO:
Tips for Building Formulas
Build a Formula Field
320
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Examples of Advanced Formula Fields
Review examples of formula fields for various types of apps that you can use and modify for your
own purposes.
EDITIONS
This document contains custom formula samples for the following topics. For details about using
the functions included in these samples, see Formula Operators and Functions on page 256.
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
Sample Account Management Formulas
Sample Account Media Service Formulas
USER PERMISSIONS
Sample Case Management Formulas
To view formula field details:
• View Setup and
Configuration
Sample Commission Calculations Formulas
Sample Contact Management Formulas
Sample Data Categorization Formulas
To create, change, or delete
formula fields:
• Customize Application
Sample Date Formulas
Sample Discounting Formulas
Sample Employee Services Formulas
Sample Expense Tracking Formulas
Sample Financial Calculations Formulas
Sample Image Link Formulas
Sample Integration Link Formulas
Sample Lead Management Formulas
Sample Metrics Formulas
Sample Opportunity Management Formulas
Sample Pricing Formulas
Sample Scoring Calculations Formulas
SEE ALSO:
Formulas: How Do I ... ?
Tips for Building Formulas
Quick Reference Guide: Formula Fields
Sample Account Management Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
321
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Account Rating
This formula evaluates Annual Revenue, Billing Country, and Type, and assigns a value of “Hot,” “Warm,” or “Cold.”
IF (AND (AnnualRevenue > 10000000,
CONTAINS (CASE (BillingCountry, "United States", "US", "America", "US", "USA", "US", "NA"),
"US")),
IF(ISPICKVAL(Type, "Manufacturing Partner"), "Hot",
IF(OR (ISPICKVAL (Type, "Channel Partner/Reseller"),
ISPICKVAL(Type, "Installation Partner")), "Warm", "Cold")),
"Cold")
In addition, you can reference this Account Rating formula field from the contact object using cross-object formulas.
Account.Account_Rating__c
Account Region
This formula returns a text value of “North,” “South,” “East,” “West,” or “Central” based on the Billing State/Province of the
account.
IF(ISBLANK(BillingState), "None",
IF(CONTAINS("AK:AZ:CA:HA:NV:NM:OR:UT:WA", BillingState), "West",
IF(CONTAINS("CO:ID:MT:KS:OK:TX:WY", BillingState), "Central",
IF(CONTAINS("CT:ME:MA:NH:NY:PA:RI:VT", BillingState), "East",
IF(CONTAINS("AL:AR:DC:DE:FL:GA:KY:LA:MD:MS:NC:NJ:SC:TN:VA:WV", BillingState), "South",
IF(CONTAINS("IL:IN:IA:MI:MN:MO:NE:ND:OH:SD:WI", BillingState), "North", "Other"))))))
Contract Aging
This formula calculates the number of days since a contract with an account was activated. If the contract Status is not “Activated,”
this field is blank.
IF(ISPICKVAL(Contract_Status__c, "Activated"),
NOW() - Contract_Activated_Date__c, null)
Sample Account Media Service Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
BBC™
Available in: both Salesforce
Classic and Lightning
Experience
News Search
This formula creates a link to a BBC news search site based on the Account Name.
HYPERLINK(
"http://www.bbc.co.uk/search/news/?q="&Name,
"BBC News")
322
Available in all editions
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Bloomberg™ News Search
This formula creates a link to an account's ticker symbol on the Bloomberg website.
HYPERLINK(
"http://www.bloomberg.com/markets/symbolsearch?query="&TickerSymbol,
"Bloomberg News")
CNN™ News Search
This formula creates a link to a CNN news search site using the Account Name.
HYPERLINK(
"http://http://www.cnn.com/search/?query="&Name,
"CNN News")
MarketWatch™ Search
This formula creates a link to an account's ticker symbol on the Marketwatch.com website.
HYPERLINK(
"http://www.marketwatch.com/investing/stock/"&TickerSymbol,
"Marketwatch")
Google™ Search
This formula creates a link to a Google search site using the Account Name.
HYPERLINK(
"http://www.google.com/#q="&Name,
"Google")
Google News Search
This formula creates a link to a Google news search site using the Account Name.
HYPERLINK(
"http://news.google.com/news/search?en&q="&Name,
"Google News")
Yahoo!™ Search
This formula creates a link to a Yahoo! search site using the Account Name.
HYPERLINK(
"http://search.yahoo.com/search?p="&Name,
"Yahoo Search")
323
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Yahoo! News Search
This formula creates a link to a Yahoo! news search site using the Account Name.
HYPERLINK(
"http://news.search.yahoo.com/search/news?p="&Name,
"Yahoo News")
Sample Case Management Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Available in: Salesforce
Classic
Autodial
Available in all editions
This formula creates a linkable phone number field that automatically dials the phone number
when clicked. In this example, replace "servername" and "call" with the name of your
dialing tool and the command it uses to dial. The merge field, Id, inserts the identifier for the
contact, lead, or account record. The first Phone merge field tells the dialing tool what number to call and the last Phone merge field
uses the value of the Phone field as the linkable text the user clicks to dial.
HYPERLINK("http://servername/call?id=" & Id & "&phone=" &
Phone, Phone)
Case Categorization
This formula displays a text value of “RED,” “YELLOW,” or “GREEN,” depending on the value of a case age custom text field.
IF(DaysOpen__c > 20, "RED",
IF(DaysOpen__c > 10, "YELLOW",
"GREEN") )
Case Data Completeness Tracking
This formula calculates the percentage of specific custom fields that contain data. The formula checks the values of two custom number
fields: Problem Num and Severity Num. If the fields are empty, the formula returns the value “0.” The formula returns a value
of “1” for each field that contains a value and multiplies this total by fifty to give you the percentage of fields that contain data.
(IF(ISBLANK(Problem_Num__c), 0, 1) + IF(ISBLANK(Severity_Num__c ), 0,1)) * 50
Suggested Agent Prompts
This formula prompts an agent with cross-sell offers based on past purchases.
CASE(Product_Purch__c,
"Printer", "Extra toner cartridges", "Camera", "Memory cards",
"Special of the day")
324
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Suggested Offers
This formula suggests a product based on the support history for a computer reseller. When the Problem custom field matches a
field, the formula field returns a suggestion.
CASE(Problem__c,
"Memory", "Suggest new memory cards", "Hard Drive failure", "Suggest new hard drive with
tape backup",
"")
Sample Commission Calculations Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Commission Amounts for Opportunities
Available in: both Salesforce
Classic and Lightning
Experience
The following is a simple formula where commission is based on a flat 2% of the opportunity
Amount.
Available in all editions
IF(ISPICKVAL(StageName, "Closed Won"),
ROUND(Amount *0.02, 2), 0)
This example calculates the commission amount for any opportunity that has a “Closed Won” stage. The value of this field will be the
amount times 0.02 for any closed/won opportunity. Open or lost opportunities will have a zero commission value.
Commission Deal Size
This formula calculates a commission rate based on deal size, returning a 9% commission rate for deals over 100,000 and an 8% commission
rate for smaller deals.
IF(Amount > 100000, 0.09, 0.08 )
Commission Greater Than or Equal To
This formula assigns the “YES” value with a commission greater than or equal to one million. Note, this is a text formula field that uses
a custom currency field called Commission.
IF(Commission__c >=
1000000, "YES", "NO")
Commission Maximum
This formula determines what commission to log for an asset based on which is greater: the user's commission percentage of the price,
the price times the discount percent stored for the account or 100 dollars. This example assumes you have two custom percent fields
on users and assets.
MAX($User.Commission_Percent__c * Price,
Price * Account_Discount__c, 100)
325
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Sample Contact Management Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Contact's Account Discount Percent
Available in: both Salesforce
Classic and Lightning
Experience
This percent formula displays the account's Discount Percent field on the contacts page.
Available in all editions
Account.Discount_Percent__c
Contact's Account Name
This formula displays the standard Account Name field on the contacts page.
Account.Name
Contact's Account Phone
This formula displays the standard Account Phone field on the contacts page.
Account.Phone
Contact's Account Rating
Use this formula to display the Account Rating field on the contacts page.
CASE(Account.Rating, "Hot", "Hot", "Warm", "Warm", "Cold", "Cold", "Not Rated")
Contact's Account Website
This formula displays the standard Account Website field on the contacts page.
Account.Website
If the account website URL is long, use the HYPERLINK function to display a label such as “Click Here” instead of the URL. For example:
IF(Account.Website="", "",
IF(
OR(LEFT(Account.Website, 7) = "http://",LEFT(Account.Website, 8) = "https://"),
HYPERLINK( Account.Website , "Click Here" ),
HYPERLINK( "http://" & Account.Website , "Click Here" )
)
)
This formula also adds the necessary "http://" or "https://" before a URL if neither were included in the URL field.
Contact's LinkedIn™ Profile
You can configure a link that appears on your contacts' profile page that sends you to their LinkedIn profile. To do so:
1. From the object management settings for contacts, go to Buttons, Links, and Actions.
2. Click New Button or Link.
326
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
3. Enter a Label for this link, like LinkedInLink.
4. Enter this formula in the content box:
http://www.linkedin.com/search/fpsearch?type=people&keywords
={!Contact.FirstName}+{!Contact.LastName}
5. Click Save.
Remember to add this link to the Contact page layout in order for it to show up.
Contact Identification Numbering
This formula displays the first five characters of a name and the last four characters of a social security number separated by a dash. Note
that this example uses a text custom field called SSN.
TRIM(LEFT(LastName, 5)) &
"-" & TRIM(RIGHT(SSN__c, 4))
Contact Preferred Phone
This formula displays the contact’s preferred contact method in a contact related list—work phone, home phone, or mobile phone—based
on a selected option in a Preferred Phone custom picklist.
CASE(Preferred_Phone__c,
"Work", "w. " & Phone,
"Home", "h. " & HomePhone,
"Mobile", "m. " & MobilePhone,
"No Preferred Phone")
Contact Priority
This formula assesses the importance of a contact based on the account rating and the contact's title. If the account rating is Hot or
the title starts with Executive, then the priority is high (P1). If the account rating is Warm or the title starts with VP then the priority
is medium (P2), and if the account rating is Cold then the priority is low (P3).
IF(OR(ISPICKVAL(Account.Rating, "Hot"), CONTAINS(Title, "Executive")), "P1",
IF(OR(ISPICKVAL(Account.Rating, "Warm"), CONTAINS(Title, "VP")), "P2",
IF(ISPICKVAL(Account.Rating, "Cold"), "P3",
"P3")
)
)
327
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Contact Yahoo! ID
This formula displays a clickable Yahoo! Messenger icon indicating if the person is logged on to the service. Users can click the icon to
launch a Yahoo! Messenger conversation with the person. This example uses a custom text field called Yahoo Name on contacts
where you can store the contact's Yahoo! Messenger ID.
HYPERLINK("ymsgr:sendIM?" & Yahoo_Name__c,
IMAGE("http://opi.yahoo.com/online?u=" & Yahoo_Name__c &
"&m;=g&t;=0", "Yahoo"))
Dynamic Address Formatting
This formula field displays a formatted mailing address for a contact in standard format, including spaces and line breaks where appropriate
depending on the country.
CASE(ShippingCountry,
"USA",
ShippingStreet & BR() &
ShippingCity & ",
" & ShippingState & " " &
ShippingPostalCode & BR()
& ShippingCountry,
"France",
ShippingStreet & BR() &
ShippingPostalCode & " " &
ShippingCity & BR() &
ShippingCountry, "etc")
Telephone Country Code
This formula determines the telephone country code of a contact based on the Mailing Country of the mailing address.
CASE(MailingCountry,
"USA", "1",
"Canada", "1",
"France", "33",
"UK", "44",
"Australia", "61",
"Japan", "81",
"?")
Unformatted Phone Number
This formula removes the parentheses and dash characters from North American phone numbers. This is necessary for some auto-dialer
software.
IF(Country_Code__c = "1", MID( Phone ,2, 3) & MID(Phone,7,3) & MID(Phone,11,4), Phone)
328
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Sample Data Categorization Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Deal Size Large and Small
Available in: both Salesforce
Classic and Lightning
Experience
This formula displays “Large Deal” for deals over one million dollars or “Small Deal” for deals under
one million dollars.
Available in all editions
IF(Sales_Price__c > 1000000,
"Large Deal",
"Small Deal")
Deal Size Small
This formula displays “Small” if the price and quantity are less than one. This field is blank if the asset has a price or quantity greater than
one.
IF(AND(Price<1,Quantity<1),"Small", null)
Product Categorization
This formula checks the content of a custom text field named Product_Type and returns “Parts” for any product with the word
“part” in it. Otherwise, it returns “Service.” Note that the values are case sensitive, so if a Product_Type field contains the text “Part”
or “PART,” this formula returns “Services.”
IF(CONTAINS(Product_Type__c, "part"), "Parts", "Service")
Sample Date Formulas
EDITIONS
Finding the Day, Month, or Year from a Date
Use the functions DAY( date ), MONTH( date ), and YEAR( date ) to return their
respective numerical values. Replace date with a value of type Date (e.g. TODAY()).
To use these functions with Date/Time values, first convert them to a date with the DATEVALUE()
function. For example, DAY( DATEVALUE( date/time )).
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
Finding Out if a Year Is a Leap Year
This formula determines whether or not a year is a leap year. A year is only a leap year if it’s divisible by 400, or if it’s divisible by four but
NOT by 100.
OR(
MOD( YEAR( date ), 400 ) = 0,
AND(
MOD( YEAR( date ), 4 ) = 0,
MOD( YEAR( date ), 100 ) != 0
)
)
329
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Finding Which Quarter a Date Is In
For standard quarters, you can determine which quarter a date falls in using this formula. This formula returns the number of the quarter
in which date falls (1–4) by dividing the current month by three (the number of months in each quarter) and taking the ceiling.
CEILING( MONTH ( date ) / 3 )
The formula for shifted quarters is similar, but shifts the month of the date by the number of months between January and the first
quarter of the fiscal year. The example below illustrates how you can find a date’s quarter if Q1 starts in February instead of January.
CEILING( ( MONTH ( date ) - 1 ) / 3)
If you want to check whether a date is in the current quarter, add a check to compare the date’s year and quarter with TODAY()’s year
and quarter.
AND(
CEILING( MONTH( date ) / 3 ) = CEILING( MONTH( TODAY() ) / 3 ),
YEAR( date ) = YEAR( TODAY() )
)
Finding the Week of the Year a Date Is In
To find the number of a date’s week of the year, use this formula:
IF(
CEILING( ( date - DATE( YEAR( date ), 1, 1) + 1) / 7) > 52,
52,
CEILING( ( date - DATE( YEAR( date ), 1, 1) + 1) / 7)
)
You can find the current week by determining how many days there have been in the current year and dividing that value by 7. The
IF() statement ensures that the week number the formula returns doesn’t exceed 52. So if the given date is December 31 of the given
year, the formula returns 52, even though it’s more than 52 weeks after the week of January.
Finding Whether Two Dates Are in the Same Month
To determine whether two Dates fall in the same month, say for a validation rule to determine whether an opportunity Close Date is in
the current month, use this formula:
AND(
MONTH( date_1 ) == MONTH( date_2 ),
YEAR( date_1 ) == YEAR( date_2 )
)
Finding the Last Day of the Month
The easiest way to find the last day of a month is to find the first day of the next month and subtract a day.
IF(
MONTH( date ) = 12,
DATE( YEAR( date ), 12, 31 ),
DATE( YEAR( date ), MONTH ( date ) + 1, 1 ) - 1
)
330
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Displaying the Month as a String Instead of a Number
To return the month as a text string instead of a number, use:
CASE(
MONTH( date ),
1, "January",
2, "February",
3, "March",
4, "April",
5, "May",
6, "June",
7, "July",
8, "August",
9, "September",
10, "October",
11, "November",
"December"
)
If your organization uses multiple languages, you can replace the names of the month with a custom label:
CASE(
MONTH( date ),
1, $Label.Month_of_Year_1,
2, $Label.Month_of_Year_2,
3, $Label.Month_of_Year_3,
4, $Label.Month_of_Year_4,
5, $Label.Month_of_Year_5,
6, $Label.Month_of_Year_6,
7, $Label.Month_of_Year_7,
8, $Label.Month_of_Year_8,
9, $Label.Month_of_Year_9,
10, $Label.Month_of_Year_10,
11, $Label.Month_of_Year_11,
$Label.Month_of_Year_12
)
Finding and Displaying the Day of the Week From a Date
To find the day of the week from a Date value, use a known Sunday (e.g. January 7, 1900) and subtract it from the date (e.g. TODAY())
to get the difference in days. The MOD() function finds the remainder of this result when divided by 7 to give the numerical value of
the day of the week between 0 (Sunday) and 6 (Saturday). The formula below finds the result and then returns the text name of that
day.
CASE(
MOD( date - DATE( 1900, 1, 7 ), 7 ),
0, "Sunday",
1, "Monday",
2, "Tuesday",
3, "Wednesday",
4, "Thursday",
5, "Friday",
"Saturday"
)
331
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Note that this formula only works for dates after 01/07/1900. If you’re working with older dates, use the same process with any Sunday
prior to your earliest date (e.g. 01/05/1800).
You can also adjust this formula if your week starts on a different day. For example, if your week starts on Monday, you can use January
8, 1900 in your condition. The new formula looks like this:
CASE(
MOD( date - DATE( 1900, 1, 8 ), 7 ),
0, "Monday",
1, "Tuesday",
2, "Wednesday",
3, "Thursday",
4, "Friday",
5, "Saturday",
"Sunday"
)
Like the formula for getting the name of the month, if your organization uses multiple languages, you can replace the names of the day
of the week with a variable like $Label.Day_of_Week_1, etc.
Finding the Next Day of the Week After a Date
To find the date of the next occurrence of a particular day of the week following a given Date, get the difference in the number of days
of the week between a date and a day_of_week, a number 0–6 where 0 = Sunday and 6 = Saturday. By adding this difference to
the current date, you’ll find the date of the day_of_week. The IF() statement in this formula handles cases where the
day_of_week is prior to the day of the week of the date value (e.g. date is a Thursday and day_of_week is a Monday) by
adding 7 to the difference.
date + ( day_of_week - MOD( date - DATE( 1900, 1, 7 ), 7 ) )
+
IF(
MOD( date - DATE( 1900, 1, 7 ), 7 ) >= day_of_week,
7,
0
)
You can substitute either a constant or another field in for the day_of_week value based on your needs.
Finding the Number of Days Between Two Dates
To find the number of days between two dates, date_1 and date_2, subtract the earlier date from the later date: date_1 —
date_2
You can alter this slightly if you want to determine a date a certain number of days in the past. For example, say you want a formula to
return true if some date field is more than 30 days prior to the current date and false otherwise. This formula does just that:
TODAY() - 30 > date
Finding the Number of Business Days Between Two Dates
Calculating how many business days passed between two dates is slightly more complex than calculating total elapsed days. The basic
strategy is to choose a reference Monday from the past and find out how many full weeks and any additional portion of a week have
332
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
passed between the reference date and the date you’re examining. These values are multiplied by five (for a five-day work week) and
then the difference between them is taken to calculate business days.
(5 * ( FLOOR(
1, 8), 7 ) )
(5 * ( FLOOR(
1, 8), 7 ) )
( date_1 - DATE( 1900, 1, 8) ) / 7 ) ) + MIN( 5, MOD( date_1 - DATE( 1900,
)
( date_2 - DATE( 1900, 1, 8) ) / 7 ) ) + MIN( 5, MOD( date_2 - DATE( 1900,
)
In this formula, date_1 is the more recent date and date_2 is the earlier date. If your work week runs shorter or longer than five
days, replace all fives in the formula with the length of your week.
Adding Days, Months, and Years to a Date
If you want to add a certain number of days to a date, add that number to the date directly. For example, to add five days to a date, the
formula is date + 5.
Adding years to a date is fairly simple, but you do need to check that the future date is valid. That is, adding five years to February 29 (a
leap year) results in an invalid date. The following formula adds num_years to date by checking if the date is February 29 and if
the future date is not in a leap year. If these conditions hold true, the formula returns March 1 in the future year. Otherwise, the formula
sets the Date to the same month and day num_years in the future.
IF(
AND(
MONTH( date ) = 2,
DAY( date ) = 29,
NOT(
OR(
MOD( YEAR( date ), 400 ) = 0,
AND(
MOD( YEAR( date ), 4 ) = 0,
MOD( YEAR( date ), 100 ) != 0
)
)
)
),
DATE( YEAR( date ) + num_years, 3, 1),
DATE( YEAR( date ) + num_years, MONTH( date ), DAY( date ) )
)
Adding months to a date is slightly more complicated as months vary in length and the cycle of months restart with each year. Therefore,
a valid day in one month (January 31) might not be valid in another month (February 31). A simple solution is to approximate each
month’s length as 365/12 days:
date + ( ( 365 / 12 ) * Number_months )
While this formula is a good estimate, it doesn’t return an exact date. For example, if you add two months to April 30 using this method,
the formula will return June 29 instead of June 30. Returning an exact date depends on your organization’s preference. For example,
when you add one month to January 31, should it return February 28 (the last day of the next month) or March 2 (30 days after January
31)?
This formula does the following:
• Returns March 1 if the future month is a February and the day is greater than 28. This portion of the formula performs the same for
both leap and non-leap years.
333
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
• Returns the first day of the next month if the future month is April, June, September, or November and the day is greater than 30.
• Otherwise, it returns the correct date in the future month.
This example formula adds two months to a given date. You can modify the conditions on this formula if you prefer different behaviors
for dates at the end of the month.
DATE(
YEAR( date ) + FLOOR( ( MONTH ( date ) + 2 - 1 ) / 12 ),
MOD( MONTH ( date ) + 2 - 1 +
IF( DAY ( date ) > CASE( MOD( MONTH( date ) + 2 - 1, 12 ) + 1,
2, 28,
4, 30,
6, 30,
9, 30,
11, 30,
31 ), 1, 0 ), 12 ) + 1,
IF( DAY( date ) > CASE( MOD( MONTH( date ) + 2 - 1, 12 ) + 1,
2, 28,
4, 30,
6, 30,
9, 30,
11, 30,
31 ),
1, DAY( date )
)
)
If you’re using these formulas for expiration dates, you might want to subtract a day from the return value to make sure that some action
is completed before the calculated date.
Adding Business Days to a Date
This formula finds three business days from a given date.
CASE(
MOD( date
3, date +
4, date +
5, date +
6, date +
date + 3
)
2
2
2
1
DATE( 1900, 1, 7 ), 7 ),
+ 3,
+ 3,
+ 3,
+ 3,
This formula finds the day of the week of the date field value. If the date is a Wednesday, Thursday, or Friday, the formula adds five
calendar days (two weekend days, three weekdays) to the date to account for the weekend. If date is a Saturday, you need four
additional calendar days. For any other day of the week (Sunday — Tuesday), simply add three days. You can easily modify this formula
to add more or less business days. The tip for getting the day of the week might be useful if you need to adjust this formula.
Finding the Hour, Minute, or Second from a Date/Time
To get the hour, minute, and second from a Date/Time field as a numerical value, use the following formulas where TZoffset is the
difference between the user’s time zone and GMT. For hour in 24–hour format:
VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) )
334
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
For hour in 12–hour format:
IF(
OR(
VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) = 0,
VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) = 12
),
12,
VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) )
IF(
VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) < 12,
0,
12
)
)
For minutes:
VALUE( MID( TEXT( date/time - TZoffset ), 15, 2 ) )
For seconds:
VALUE( MID( TEXT( date/time - TZoffset ), 18, 2 ) )
And, to get “AM” or “PM” as a string, use:
IF(
VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) < 12,
"AM",
"PM"
)
To return the time as a string in “HH:MM:SS A/PM” format, use the following formula:
IF(
OR(
VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) = 0,
VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) = 12
),
"12",
TEXT( VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) )
IF(
VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) < 12,
0,
12
)
)
)
& ":" &
MID( TEXT( date/time - TZoffset ), 15, 2 )
& ":" &
MID( TEXT( date/time - TZoffset ), 18, 2 )
& " " &
IF(
335
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) < 12,
"AM",
"PM"
)
When working with time in formula fields, you need to consider the time difference between your organization and GMT. See A Note
About Date/Time and Time Zones on page 310 for help understanding the time zone offset used in this formula.
Finding the Elapsed Time Between Date/Times
To find the difference between two Date values as a number, subtract one from the other like so: date_1 — date_2 to return the
difference in days.
Finding the elapsed time between two Date/Time values is slightly more complex. This formula converts the difference between two
Date/Time values, datetime_1 and datetime_2, to days, hours, and minutes.
IF(
datetime_1 - datetime_2 > 0 ,
TEXT( FLOOR( datetime_1 - datetime_2 ) ) & " days "
& TEXT( FLOOR( MOD( (datetime_1 - datetime_2 ) * 24, 24 ) ) ) & " hours "
& TEXT( ROUND( MOD( (datetime_1 - datetime_2 ) * 24 * 60, 60 ), 0 ) ) & " minutes",
""
)
Finding the Number of Business Hours Between Two Date/Times
The formula for finding business hours between two Date/Time values expands on the formula for finding elapsed business days. It
works on the same principle of using a reference Date/Time, in this case 1/8/1900 at 16:00 GMT (9 a.m. PDT), and then finding your
Dates’ respective distances from that reference. The formula rounds the value it finds to the nearest hour and assumes an 8–hour, 9 a.m.
– 5 p.m. work day.
ROUND( 8 * (
( 5 * FLOOR( ( DATEVALUE( date/time_1 ) - DATE( 1900, 1, 8) ) / 7) +
MIN(5,
MOD( DATEVALUE( date/time_1 ) - DATE( 1900, 1, 8), 7) +
MIN( 1, 24 / 8 * ( MOD( date/time_1 - DATETIMEVALUE( '1900-01-08 16:00:00' ), 1 ) )
)
)
)
( 5 * FLOOR( ( DATEVALUE( date/time_2 ) - DATE( 1900, 1, 8) ) / 7) +
MIN( 5,
MOD( DATEVALUE( date/time_2 ) - DATE( 1996, 1, 1), 7 ) +
MIN( 1, 24 / 8 * ( MOD( date/time_2 - DATETIMEVALUE( '1900-01-08 16:00:00' ), 1) )
)
)
)
),
0 )
336
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
You can change the eights in the formula to account for a longer or shorter work day. If you live in a different time zone or your work
day doesn’t start at 9:00 a.m., change the reference time to the start of your work day in GMT. See A Note About Date/Time and Time
Zones for more information.
SEE ALSO:
Using Date and Date/Time Values in Formulas
Examples of Advanced Formula Fields
Tips for Building Formulas
Sample Discounting Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Maintenance and Services Discount
Available in: both Salesforce
Classic and Lightning
Experience
This formula field uses two custom currency fields: Maintenance Amount and Services
Amount. It displays “Discounted” on an opportunity if its maintenance amount and services amount
do not equal the opportunity Amount standard field value. Otherwise, it displays "Full Price."
Available in all editions
IF(Maintenance_Amount__c + Services_Amount__c <> Amount,
"Discounted",
"Full Price")
Opportunity Discount Amount
This formula calculates the difference of the product Amount less the Discount Amount. Note that Discount Amount is a
custom currency field.
Amount Discount_Amount__c
Opportunity Discount Rounded
Use this formula to calculate the discounted amount of an opportunity rounded off to two digits. This example is a number formula field
on opportunities that uses a custom percent field called Discount Percent.
ROUND(Amount-Amount* Discount_Percent__c,2)
Opportunity Discount with Approval
This formula adds a “Discount Approved” checkbox to an opportunity. It uses conditional logic to check the value of the approval flag
before calculating the commission.
IF(Discount_Approved__c, ROUND(Amount – Amount * DiscountPercent__c, 2), Amount)
337
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Sample Employee Services Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Bonus Calculation
Available in: both Salesforce
Classic and Lightning
Experience
This example determines an employee's bonus amount based on the smallest of two amounts: the
employee's gross times bonus percent or an equally divided amount of the company's performance
amount among all employees. It assumes you have custom number field for Number of
Employees, a custom percent field for Bonus Percent, and currency custom fields for the
employee's Gross and company's Performance.
Available in all editions
MIN(Gross__c * Bonus_Percent__c,
Performance__c / Number_of_Employees__c)
Employee 401K
This example formula determines which amount to provide in employee 401K matching based on a matching program of half of the
employee's contribution or $250, whichever is less. It assumes you have custom currency field for Contribution.
MIN(250, Contribution__c /2)
Hours Worked Per Week
This formula uses a custom tab to enable time tracking of hours worked per day. It uses a formula field to sum the hours per week.
MonHours__c + TuesHours__c + WedsHours__c + ThursHours__c + FriHours__c
Total Pay Amount
This formula determines total pay by calculating regular hours multiplied by a regular pay rate, plus overtime hours multiplied by an
overtime pay rate.
Total Pay =
IF(Total_Hours__c <= 40, Total_Hours__c * Hourly_Rate__c,
40 * Hourly_Rate__c +
(Total_Hours__c - 40) * Overtime_Rate__c)
Sample Expense Tracking Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Expense Identifier
Available in: both Salesforce
Classic and Lightning
Experience
This formula displays the text “Expense-” followed by trip name and the expense number. This is a
text formula field that uses an expense number custom field.
"Expense-" &
Trip_Name__c & "-" & ExpenseNum__c
338
Available in all editions
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Mileage Calculation
This formula calculates mileage expenses for visiting a customer site at 35 cents a mile.
Miles_Driven__c * 0.35
Sample Financial Calculations Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Compound Interest
Available in: both Salesforce
Classic and Lightning
Experience
This formula calculates the interest, you will have after T years, compounded M times per year.
Available in all editions
Principal__c * ( 1 + Rate__c / M ) ^ ( T * M) )
Compound Interest Continuous
This formula calculates the interest that will have accumulated after T years, if continuously compounded.
Principal__c * EXP(Rate__c * T)
Consultant Cost
This formula calculates the number of consulting days times 1200 given that this formula field is a currency data type and consulting
charges a rate of $1200 per day. Note that Consulting Days is a custom field.
Consulting_Days__c *
1200
Gross Margin
This formula provides a simple calculation of gross margin. In this formula example, Total Sales and Cost of Goods Sold
are custom currency fields.
Total_Sales__c - Cost_of_Goods_Sold__c
Gross Margin Percent
This formula calculates the gross margin based on a margin percent.
Margin_percent__c * Items_Sold__c * Price_item__c
Payment Due Indicator
This formula returns the date five days after the contract start date whenever Payment Due Date is blank. Payment Due
Date is a custom date field.
(BLANKVALUE(Payment_Due_Date__c, StartDate +5)
339
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Payment Status
This formula determines if the payment due date is past and the payment status is “UNPAID.” If so, it returns the text “PAYMENT OVERDUE”
and if not, it leaves the field blank. This example uses a custom date field called Payment Due Date and a text custom field called
Payment Status on contracts.
IF(
AND(Payment_Due_Date__c < TODAY(),
ISPICKVAL(Payment_Status__c, "UNPAID")),
"PAYMENT OVERDUE",
null )
Sample Image Link Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
Yahoo! Instant
Messenger™
Image
This formula displays an image that indicates whether a contact or user is currently logged in to
Yahoo! Instant Messenger. Clicking the image launches the Yahoo! Instant Messenger window. This
formula uses a custom text field called Yahoo Name to store the contact or user’s Yahoo! ID.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
IF(ISBLANK(Yahoo_Name__c),"", HYPERLINK("ymsgr:sendIM?" & Yahoo_Name__c,
IMAGE("http://opi.yahoo.com/online?u=" & Yahoo_Name__c & "&m=g&t=0", " ")))
Flags for Case Priority
This formula displays a green, yellow, or red flag image to indicate case priority.
IMAGE(
CASE( Priority,
"Low", "/img/samples/flag_green.gif",
"Medium", "/img/samples/flag_yellow.gif",
"High", "/img/samples/flag_red.gif",
"/s.gif"),
"Priority Flag")
Color Squares for Case Age
This formula displays a 30 x 30 pixel image of a red, yellow, or green, depending on the value of a Case Age custom number field.
IF( Case_Age__c > 20,
IMAGE("/img/samples/color_red.gif", "red", 30, 30),
IF( Case_Age__c > 10,
IMAGE("/img/samples/color_yellow.gif", "yellow", 30, 30),
IMAGE("/img/samples/color_green.gif", "green", 30, 30)
))
340
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Traffic Lights for Status
This formula displays a green, yellow, or red traffic light images to indicate status, using a custom picklist field called Project Status.
Use this formula in list views and reports to create a “Status Summary” dashboard view.
IMAGE(
CASE(Project_Status__c,
"Green", "/img/samples/light_green.gif",
"Yellow", "/img/samples/light_yellow.gif",
"Red", "/img/samples/light_red.gif",
"/s.gif"),
"status color")
Stars for Ratings
This formula displays a set of one to five stars to indicate a rating or score.
IMAGE(
CASE(Rating__c,
"1", "/img/samples/stars_100.gif",
"2", "/img/samples/stars_200.gif",
"3", "/img/samples/stars_300.gif",
"4", "/img/samples/stars_400.gif",
"5", "/img/samples/stars_500.gif",
"/img/samples/stars_000.gif"),
"rating")
Consumer Reports™—Style Colored Circles for Ratings
This formula displays a colored circle to indicate a rating on a scale of one to five, where solid red is one, half red is two, black outline is
three, half black is four, and solid black is five.
IMAGE(
CASE(Rating__c,
"1", "/img/samples/rating1.gif",
"2", "/img/samples/rating2.gif",
"3", "/img/samples/rating3.gif",
"4", "/img/samples/rating4.gif",
"5", "/img/samples/rating5.gif",
"/s.gif"),
"rating")
Horizontal Bars to Indicate Scoring
This formula displays a horizontal color bar (green on a white background) of a length that is proportional to a numeric score. In this
example, the maximum length of the bar is 200 pixels.
IMAGE("/img/samples/color_green.gif", "green", 15, Industry_Score__c * 2) &
IMAGE("/s.gif", "white", 15,
200 - (Industry_Score__c * 2))
341
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Sample Integration Link Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Application API Link
Available in: both Salesforce
Classic and Lightning
Experience
This formula creates a link to an application outside Salesforce, passing the parameters so that it
can connect to Salesforce via the SOAP API and create the necessary event.
Available in all editions
HYPERLINK ("https://www.myintegration.com?sId=" & GETSESSIONID() & "?&rowID=" & Name &
"action=CreateTask","Create a Meeting Request")
Important: $Api.Session_ID and GETSESSIONID() return the same value, an identifier for the current session in the
current context. This context varies depending on where the global variable or function is evaluated. For example, if you use either
in a custom formula field, and that field is displayed on a standard page layout in Salesforce Classic, the referenced session will be
a basic Salesforce session. That same field (or the underlying variable or formula result), when used in a Visualforce page, references
a Visualforce session instead.
Session contexts are based on the domain of the request. That is, the session context changes whenever you cross a hostname
boundary, such as from .salesforce.com to .visual.force.com or .lightning.force.com.
Session identifiers from different contexts, and the sessions themselves, are different. When you transition between contexts, the
old session is replaced by the new one, and the old session is no longer valid. The session ID also changes at this time.
Normally Salesforce transparently handles session hand-off between contexts, but if you’re passing the session ID around yourself,
be aware that you might need to re-access $Api.Session_ID or GETSESSIONID() from the new context to ensure a
valid session ID.
Note also that not all sessions are created equal. In particular, sessions obtained in a Lightning Experience context have reduced
privileges, and don't have API access. You can't use these session IDs to make API calls.
Shipment Tracking Integration
This formula creates a link to FedEx, UPS, or DHL shipment tracking websites, depending on the value of a Shipping Method
custom picklist field. Note that the parameters shown in this example for FedEx, UPS, and DHL websites are illustrative and do not
represent the correct parameters for all situations.
CASE(Shipping_Method__c,
"Fedex",
HYPERLINK("http://www.fedex.com/Tracking?ascend_header=1&clienttype
=dotcom&cntry_code=us&language=english&tracknumbers= "& tracking_id__c,"Track"),
"UPS",
HYPERLINK("http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion
=5.0&sort_by=status&loc=en_US&InquiryNumber1= "& tracking_id__c & "&track.x=32&track.y=7",
"Track") ,
"DHL",
HYPERLINK("http://track.dhl-usa.com/TrackByNbr.asp?ShipmentNumber=" &
tracking_id__c,"Track"), "")
342
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Skype™ Auto Dialer Integration
This formula creates a linkable phone number field that automatically dials the phone number via the Skype VOIP phone application. It
requires installation of the Skype application (a third-party product not provided by Salesforce) on your desktop.
HYPERLINK("callto://+" & Country_Code__c & Phone_Unformatted__c, Phone)
Sample Lead Management Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Lead Aging (for open leads)
Available in: both Salesforce
Classic and Lightning
Experience
This formula checks to see if a lead is open and if so, calculates the number of days it has been open
by subtracting the date and time created from the current date and time. The result is the number
of days open rounded to zero decimal places. If the lead is not open, this field is blank.
Available in all editions
IF(ISPICKVAL(Status,
"Open"), ROUND(NOW()-CreatedDate, 0), null)
Lead Data Completeness
This formula calculates the percent of certain lead fields that your sales personnel enter. The formula field checks the values of two
custom number fields: Phone and Email. If the fields are empty, the formula returns the value “0.” The formula returns a value of “1”
for each field that contains a value and multiplies this total by fifty to give you the percentage of fields that contain data.
(IF(Phone = "", 0, 1) + IF(Email = "", 0, 1) ) * 50
Lead Numbering
This formula returns a number value for the text value in the auto-number field Lead Number. This can be useful if you want to use
the Lead Number field in a calculation, such as round-robin or other routing purposes. Note that auto-number fields are text fields
and must be converted to a number for numeric calculations.
VALUE(Lead_Number__c)
Round-Robin Assignment of Cases or Leads
The following formula example for leads assumes you have three lead queues and you want to assign an equal number of incoming
leads to each queue. You can also assign cases using a similar formula.
MOD(VALUE(Lead_Number__c),
3)
This formula is for a custom formula field named Round_Robin_ID that assigns each lead a value of 0, 1, or 2. This formula uses a custom
auto-number field called Lead Number that assigns each lead a unique number starting with 1. The MOD function divides the lead
number by the number of lead queues available (three in this example) and returns a remainder of 0, 1, or 2. Use the value of this formula
field in your lead assignment rules to assign lead records to different queues. For example:
• Round_Robin_ID = 0 is assigned to Queue A
• Round_Robin_ID = 1 is assigned to Queue B
• Round_Robin_ID = 2 is assigned to Queue C
343
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Sample Metrics Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Temperature Conversion
Available in: both Salesforce
Classic and Lightning
Experience
This formula converts Celsius degrees to Fahrenheit.
Available in all editions
1.8 * degrees_celsius__c + 32
Unit of Measure Conversion
This formula converts kilometers to miles.
Miles__c/.621371192
Sample Opportunity Management Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Expected Product Revenue
Available in: both Salesforce
Classic and Lightning
Experience
This formula calculates total revenue from multiple products, each with a different probability of
closing.
Available in all editions
ProductA_probability__c * ProductA_revenue__c + ProductB_probability__c * ProductB_revenue__c
Maintenance Calculation
This formula calculates maintenance fees as 20% of license fees per year. Maintenance Years is a custom field on opportunities.
Amount * Maint_Years__c * 0.2
Monthly Subscription-Based Calculated Amounts
This formula calculates an opportunity amount based on a monthly subscription rate multiplied by the subscription period.
Monthly_Amount__c * Subscription_Months__c
Monthly Value
This formula divides total yearly value by 12 months.
Total_value__c / 12
344
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Opportunity Additional Costs
This formula calculates the sum of the product Amount, maintenance amount, and services fees. Note that Maint amount and
Service Fees are custom currency fields.
Amount + Maint_Amount__c +
Services_Amount__c
Opportunity Categorization
This formula uses conditional logic to populate an Opportunity category text field, based on the value of the Amount standard
field. Opportunities with amounts less than $1500 are “Category 1,” those between $1500 and $10000 are “Category 2,” and the rest are
“Category 3.” This example uses nested IF statements.
IF(Amount < 1500, "Category 1", IF(Amount > 10000, "Category 3", "Category 2"))
Opportunity Data Completeness
This formula takes a group of fields and calculates what percent of them are being used by your personnel. This formula field checks five
fields to see if they are blank. If so, a zero is counted for that field. A “1” is counted for any field that contains a value, and this total is
divided by five (the number of fields evaluated). This formula requires you to select the Treat blank fields as blanks option under Blank
Field Handling while the Advanced Formula subtab is showing.
(IF(ISBLANK(Maint_Amount__c), 0, 1) +
IF(ISBLANK(Services_Amount__c), 0,1) +
IF(ISBLANK(Discount_Percent__c), 0, 1) +
IF(ISBLANK(Amount), 0, 1) +
IF(ISBLANK(Timeline__c), 0, 1)) / 5
Opportunity Expected License Revenue
This formula calculates expected revenue for licenses based on probability of closing.
Expected_rev_licenses__c * Probability
Opportunity Revenue Text Display
This formula returns the expected revenue amount of an opportunity in text format without a dollar sign. For example, if the Expected
Revenue of a campaign is “$200,000,” this formula field displays “200000.”
TEXT(ExpectedRevenue)
Opportunity Total Deal Size
This formula calculates the sum of maintenance and services amounts.
Amount + Maint_Amount__c + Services_Amount__c
Opportunity Total Price Based on Units
This formula generates proposal pricing based on unit price and total volume.
Unit_price__c * Volume__c * 20
345
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Professional Services Calculation
This formula estimates professional service fees at an average loaded rate of $1200 per day. Consulting Days is a custom field
on opportunities.
Consulting_Days__c * 1200
Stage-Based Sales Document Selection
This formula Identifies a relevant document in the Documents tab based on opportunity Stage. Use document IDs in the form of
“00l30000000j7AO.”
CASE(StageName,
"Prospecting", "Insert 1st Document ID",
"Qualification", "Insert 2nd Document ID",
"Needs Analysis", "Insert 3rd Document ID",
"Value Proposition", ...
)
)
Sales Coach
This formula creates a hyperlink that opens a stage-specific document stored in the Documents tab. It uses the previously defined custom
formula field that identifies a document based on opportunity Stage. See Stage-Based Sales Document Selection on page 346.
HYPERLINK("/servlet/servlet.FileDownload?file=" & Relevant_Document__c, "View Document in
New Window")
Shipping Cost by Weight
This formula calculates postal charges based on weight.
package_weight__c * cost_lb__c
Shipping Cost Percentage
This formula calculates shipping cost as a fraction of total amount.
Ship_cost__c / total_amount__c
Tiered Commission Rates
This formula calculates the 2% commission amount of an opportunity that has a probability of 100%. All other opportunities will have
a commission value of zero.
IF(Probability = 1,
ROUND(Amount * 0.02, 2),
0)
346
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Total Contract Value from Recurring and Non-Recurring Revenue
This formula calculates both recurring and non-recurring revenue streams over the lifetime of a contract.
Non_Recurring_Revenue__c + Contract_Length_Months__c * Recurring_Revenue__c
Sample Pricing Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Total Amount
Available in: both Salesforce
Classic and Lightning
Experience
This formula calculates a total amount based on unit pricing and total units.
Available in all editions
Unit_price__c * Total_units__c
User Pricing
This formula calculates a price per user license.
Total_license_rev__c / Number_user_licenses__c
Sample Scoring Calculations Formulas
For details about using the functions included in these samples, see Formula Operators and Functions
on page 256.
EDITIONS
Lead Scoring
Available in: both Salesforce
Classic and Lightning
Experience
This formula scores leads, providing a higher score for phone calls than website requests.
Available in all editions
CASE(LeadSource, "Phone", 2, "Web", 1, 0)
Here's a formula that scores a lead based on his or her rating:
CASE(1, IF(ISPICKVAL(Rating, "Hot"), 1, 0), 3, IF(ISPICKVAL(Rating, "Warm"), 1, 0), 2,
IF(ISPICKVAL(Rating, "Cold"), 1, 0), 1))
Customer Success Scoring
This formula uses a simple scoring algorithm to rank customers a high score for positive survey results in Salesforce.
Survey_Question_1__c * 5 + Survey_Question_2__c *2
347
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Formulas: How Do I ... ?
EDITIONS
Common Math Calculations
Available in: both Salesforce
Classic and Lightning
Experience
• Add numbers?
• Convert text into a number?
• Divide numbers?
Available in: All Editions
• Multiply numbers?
Some How Do I's are not
relevant to Database.com
• Round numbers?
• Subtract numbers?
USER PERMISSIONS
Common Text Functions
To view formula field details:
• View Setup and
Configuration
• Check if a field contains specified text?
• Check if a picklist field contains a specified value?
• Combine first and last names?
To create, change, or delete
formula fields:
• Customize Application
• Convert numbers into text?
• Create a hyperlink field?
Advanced Formulas
• Calculate Commission Amounts for Opportunities?
• Set Up Round-Robin Assignment of Cases or Leads?
• Set Up Opportunity Discount Rounded?
Custom Summary Formulas for Reports
• Calculate the sum of all leads that have Email Opt Out and Do Not Call fields selected?
• Calculate the difference of all Amount fields and all Discounted Amount fields on opportunities?
• Calculate the average age of all opportunities?
• Calculate what percent of all opportunities are closed won?
• Calculate the number of active Salesforce users to the 2nd power for administration?
• Calculate the duration of all activities (minutes) times the number of records per 24 hours?
• Calculate the average percent margin on a product-by-product level across many opportunities?
• Calculate the percentage of one product compared to all products in closed opportunities?
• Calculate the change in revenue from opportunities between months?
Cross-Object Formulas
• Display a Percent field from a parent object?
• Display a text field from a parent object?
• Display a phone number field from a parent object?
• Display a picklist field from a parent object?
• Display a URL field from a parent object?
348
Extend Salesforce with Clicks, Not Code
Calculate Field Values With Formulas
Common Formula Errors
Review common errors that can occur with formulas and how to fix them.
EDITIONS
• “#Error!” displays for a formula field whenever an error occurs while calculating the value of a
formula. To resolve the error, check your formula.
– Is the formula dividing by zero? If so, check if the denominator of your expression is zero
and provide an alternative value. For example, the following campaign formula field is blank
if the number of opportunities is zero:
Available in: both Salesforce
Classic and Lightning
Experience
Available in all editions
IF(NumberOfOpportunities > 0,
NumberOfWonOpportunities / NumberOfOpportunities, null)
– Is the formula calculating a value larger than the maximum value of the current type? If so, you can append L to numeric values
to make them Long so the intermediate products will be Long and no overflow occurs. For example, the following example
shows how to correctly compute the amount of milliseconds in a year by multiplying Long numeric values.
Long MillsPerYear = 365L * 24L * 60L * 60L * 1000L;
Long ExpectedValue =
31536000000L;
System.assertEquals(MillsPerYear, ExpectedValue);
– Is the formula calculating the square root of a negative number? If so, use an IF function similar to the one above to check if the
value is a positive number.
– Is the formula calculating the LOG of a negative number? If so, use an IF function similar to the one above to make sure that the
number is positive.
– Is the formula using the VALUE function with text that contains special characters? For examples of special characters, see Formula
Operators and Functions on page 256.
– Make sure the formula does not contain a HYPERLINK function within a text function, such as LEFT(
HYPERLINK("http://MYCOMPANY.ORG ", "MYCOMPANY ") , 5).
– Is the formula disabled or referencing a disabled formula field? Salesforce disables formula fields when they are deleted and they
remain disabled after they are restored. To enable disabled formula fields, edit and save the field. For more information on deleted
custom fields and restoring them, see Manage Deleted Custom Fields on page 154.
• “#Too Big!” displays if your formula output is over 18 digits. When this happens, check your formula for calculations that could result
in more than 18 digits. Avoid multiplying large numbers, raising a large number to a power, or dividing by a very small number.
• CASE functions return an error whenever any of the expressions return an error, regardless of which one should be returned. For
example, CASE(Field__c,"Partner", "P", "Customer", "C", LEFT(Field__c, -5)) returns an error
even if the value of the field is “Partner” or “Customer” because the last statement is illogical.
• Prevent division by zero errors by including an IF function that determines if the value of a field is zero. For example, IF(Field__c
=0,0, 25/Field__c).
349
Extend Salesforce with Clicks, Not Code
Generate Emails From Records
Generate Emails From Records
A merge field is a field you can put in an email template, mail merge template, custom link, or
formula to incorporate values from a record. For example, you can place a merge field in an email
template so that the greeting includes the recipient’s name rather than a generic “Hello!”.
EDITIONS
You can use merge fields within custom formula fields, s-controls, custom links, custom buttons,
Visualforce pages, and when you create email or mail merge templates.
Available in: both Salesforce
Classic and Lightning
Experience
Merge field names are determined when you create a new custom field or object. Field Name
is automatically populated based on what you type into Field Label. You can customize this
field if you want, but keep in mind that the name must:
The available merge fields
vary according to which
Salesforce edition you have.
• Only use underscores and alphanumeric characters
• Begin with a letter and end with a letter
• Not include spaces
• Not contain two consecutive underscores
Important: Ensure that the custom field name and label are unique for that object.
• If a standard and custom field have identical names or labels, the merge field displays the custom field value.
• If two custom fields have identical names or labels, the merge field may display an unexpected value.
If you create a field label called Email and a standard field labeled Email already exists, the merge field may be unable to
distinguish between the fields. Adding a character to the custom field name makes it unique. For example, Email2.
To find the merge field name for an object or field in Salesforce, visit the object or field’s detail page and refer to Field Name.
To incorporate merge fields, use the editor in the respective feature. Salesforce provides valid merge fields in each editor for all related
standard and custom objects. If you’re using the Connect for Office Word add-in to create mail merge templates, you’ll see a complete
list of valid merge fields to insert.
Merge Field Syntax
A merge field’s syntax can vary depending on where you’re using the field. To make sure you’re using the correct syntax, select
merge fields from the drop-down list in the editor where you’re using the merge field.
Merge Fields for Validation Rules
Merge Fields for Formulas
Merge Fields for Cross-Object Formulas
Merge Field Tips
Here are a few pointers for getting the most out of merge fields.
350
Extend Salesforce with Clicks, Not Code
Generate Emails From Records
Merge Field Syntax
A merge field’s syntax can vary depending on where you’re using the field. To make sure you’re
using the correct syntax, select merge fields from the drop-down list in the editor where you’re
using the merge field.
Custom objects and fields are always appended with __c when referenced. Field labels are
preceded by the object, and all spaces are converted to underscores. For example,
Account.CreatedDate references the Created Date standard field for the account
object.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
The available merge fields
vary according to which
Salesforce edition you have.
In standard relationships, the name of the relationship is the master object. For example, you can
reference the account name from a contact validation rule using Account.Name; you can
reference the phone number of the account creator from an opportunity product formula field
using Opportunity.Account.CreatedBy.Phone. In custom relationships, the name of the relationship is the value specified
in Field Name with __r appended to it. For example, you can reference contact email from a custom object validation rule using
Contact__r.Email.
Merge Fields for Validation Rules
A merge field is a field you can put in an email template, mail merge template, custom link, or
formula to incorporate values from a record.
EDITIONS
Syntax and Formatting
Available in: both Salesforce
Classic and Lightning
Experience
When you insert a merge field in a validation rule, the syntax consists of the object, a period, and
the field name. For example, $User.State corresponds with a user’s state or province.
A merge field’s syntax can vary depending on where you’re using the field. To make sure you’re
using the correct syntax, select merge fields from the drop-down list in the editor where you’re
using the merge field. The merge fields for validation rules correspond directly with the fields in
your app.
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
For a list of fields in an object, from the management settings for the object, go to the fields section.
Important:
• If two or more custom objects have matching names or labels, only one of the objects
appears when you select from available merge fields. Make sure that all custom objects
have unique names and labels so that you can select merge fields from any of the objects.
Limitations
Validation rules can’t reference merge fields for:
• Auto number fields, such as Requisition Number
• Compound fields, such as addresses, first and last names, dependent picklists, and dependent lookups
Note: Validation rules can reference merge fields individual address fields, such as Billing City.
• Campaign statistic fields, including statistics for individual campaigns and campaign hierarchies
351
Extend Salesforce with Clicks, Not Code
Generate Emails From Records
Tips
• Some merge fields display as radio buttons but function like picklist fields when referenced in a formula.
Use the values “Read,” “Edit,” and “None” in a formula when referencing:
– $UserRole.CaseAccessForAccountOwner
– $UserRole.OpportunityAccessForAccountOwner
– CaseAccessLevel (on Territory)
– OpportunityAccessLevel (on Territory)
Use the values “Read,” “Edit,” and “All” in a formula when referencing:
– AccountAccessLevel (on Territory)
• Use the RecordType.Id merge field in your formula to apply different validations for different record types.
SEE ALSO:
Find Object Management Settings
Merge Fields for Formulas
A merge field is a field you can put in an email template, mail merge template, custom link, or
formula to incorporate values from a record.
EDITIONS
Syntax and Formatting
Available in: both Salesforce
Classic and Lightning
Experience
Merge fields for formulas aren’t enclosed in curly braces or preceded by an exclamation point, nor
are they preceded by the type of record. For example: AccountNumber. To ensure you’re using
the correct syntax, use the Insert Field button or the drop-down list in the formula editor.
Available in all editions
SEE ALSO:
Tips for Using Merge Fields in Formulas
Build a Formula Field
Merge Fields for Cross-Object Formulas
A merge field is a field you can put in an email template, mail merge template, custom link, or
formula to incorporate values from a record.
EDITIONS
Cross-object formulas are formulas that span two related objects and reference merge fields on
those objects. Cross-object formulas can reference merge fields from a master (“parent”) object if
an object is on the detail side of a master-detail relationship. Cross-object formulas also work with
lookup relationships. For example, you can write a cross-object formula that references the
Account Name for a contact associated with a case. In this example, you would type
Contact.Account.Name in a formula on the Case object.
Available in: Salesforce
Classic
352
Available in all editions
Extend Salesforce with Clicks, Not Code
Generate Emails From Records
Syntax and Formatting
Merge fields for formulas aren’t enclosed in curly braces or preceded by an exclamation point. Use the relationship names of the objects,
not the labels. Although the relationship name is often the same as the object name, it is technically the field name of the relationship
field.
To reference the parent account name from Account object, the syntax is Parent.Name, not Account.Name. When referencing
a custom object, add two underscores and the letter r to its name. For example, Position__r.title__c references the Job
Title field (title__c) on a Position custom object.
Limitations
You can’t reference:
• Merge fields for objects related to activities. For example, merge fields for contacts and accounts are not available in task and event
formulas.
• The $RecordType global variable—it only resolves to the record containing the formula, not the record to which the formula
spans. Starting with the Spring ’13 release, when you create a new formula the $RecordType global variable is only available
for default value formulas.
The value of the Profile.Name merge field differs depending on the context of the cross-object formula field that references it. On
detail pages, the value is the profile name, as expected. In list views and reports, the value is the internal value of the associated profile
instead. If you use Profile.Name in a formula, use it within an OR function to ensure that the formula always returns the intended
result. For example:
IF
(OR
(LastModifiedBy.Profile.Name = "Standard User", LastModifiedBy.Profile.Name =
"PT2"),
"Standard", "Not Standard")
None of the above applies to profile names referenced by the $Profile global variable.
Merge Field Tips
Here are a few pointers for getting the most out of merge fields.
EDITIONS
Tip: In Lightning Experience, modals that display merge fields provide a list of fields to use
with that record. If there’s a merge field you want to use that’s not listed in the modal, type
it as plain text.
• To use a merge field as the destination of a link, insert the merge field after http://.
• Salesforce rounds numbers referenced in merge fields according to the user’s locale, not the
number of decimal spaces specified in the number field configuration.
Available in: both Salesforce
Classic and Lightning
Experience
The available merge fields
vary according to which
Salesforce edition you have.
• You can store the name of an account, contact, or lead in your organization’s default language
(the local name), in addition to the account or user’s default language (the standard name). If
the local name is blank, the standard merge field name is used.
• To reference a stand-alone file, use $Resource.<resource_name>, where <resource_name> is the name you specified
when you uploaded the resource.
• If you're using the Translation Workbench to translate custom field names, users can look up merge fields in their chosen language.
• You can’t use a lookup field as a merge field in an email template. You can, however, create a hidden formula field on the page
layout that pulls the value from the lookup field. Then include the hidden field in the email template.
353
Extend Salesforce with Clicks, Not Code
Deliver Custom Notifications with Platform Events
Deliver Custom Notifications with Platform Events
Use platform events to deliver secure and scalable custom notifications within Salesforce or from
external sources. Define fields to customize your platform event. Your custom platform event
determines the event data that the Force.com platform can produce or consume.
By using platform events, publishers can send customized event data through Apex or an API.
Subscribers can receive custom notifications from Salesforce or an external system using Apex or
CometD clients. Based on the events contents, subscribers can process custom business logic, such
as sending an email or logging a case. For example, a software system monitoring a printer can
make an API call to publish an event when the ink is low. The custom printer event can contain
custom fields for the printer model, serial number, and ink level. The event is processed in Salesforce
by an Apex trigger that places an order for a new cartridge.
Platform events simplify the process of communicating changes and responding to them without
writing complex logic. Publishers and subscribers communicate with each other through events.
Multiple subscribers can listen to the same event and carry out different actions.
EDITIONS
Available in both Salesforce
Classic and Lightning
Experience.
Available in: Performance,
Unlimited, Enterprise, and
Developer Editions
USER PERMISSIONS
To create and edit platform
event definitions:
• Customize Application
Define Your Platform Event
To define a platform event in Salesforce Classic or Lightning Experience:
1. From Setup, enter Platform Events in the Quick Find box, then select Platform Events.
2. On the Platform Events page, click New Platform Event.
3. Complete the standard fields, and optionally add a description.
4. For Event Type, select Standard Volume.
Note: If you are enrolled in the High-Volume Platform Events pilot, the Event Type dropdown also displays the High Volume
option for creating high-volume events. For more information about the pilot, see the Salesforce Winter ’18 Release Notes.
5. Click Save.
6. To add a field, in the Custom Fields & Relationships related list, click New.
7. Follow the custom field wizard to set up the field properties.
Note: In Lightning Experience, platform events aren’t shown in the Object Manager’s list of standard and custom objects and
aren’t available in Schema Builder.
A platform event is a special kind of Salesforce entity, similar in many ways to an sObject. An event notification is an instance of a platform
event, similar to how a record is an instance of a custom object. Unlike custom objects, you can’t update or delete event records. You
also can’t view event records in the Salesforce user interface, and platform events don’t have page layouts. When you delete a platform
event definition, it’s permanently deleted.
Publish and Subscribe to Platform Events
After you define your platform event, you can publish event notifications and subscribe to events using Apex or an API.
In Apex, you publish event notifications by inserting event records with the EventBus.publish static method. To receive published
notifications, write an after insert trigger on your event object. In the trigger, you can inspect each event notification and perform
some business logic. You don’t need to create a channel, because Salesforce creates a channel for each defined platform event.
354
Extend Salesforce with Clicks, Not Code
Deliver Custom Notifications with Platform Events
Using an API, you publish events by creating records of your event in the same way that you insert sObjects. You can use any Salesforce
API to create platform events, such as SOAP API, REST API, or Bulk API. Unlike Apex, there is no extra call to publish the event. Subscribe
to events with CometD clients or by writing Apex after insert triggers on your event object.
Standard Fields
Platform events include standard fields. These fields appear on the New Platform Event page.
Field
Description
Label
Name used to refer to your platform event in a user interface page.
Plural Label
Plural name of the platform event.
Starts with a vowel sound
If it’s appropriate for your org’s default language, indicate whether
the label is preceded by “an” instead of “a.”
Object Name
Unique name used to refer to the platform event when using the
API. In managed packages, this name prevents naming conflicts
with package installations. Use only alphanumeric characters and
underscores. The name must begin with a letter and have no
spaces. It cannot end with an underscore nor have two consecutive
underscores.
Description
Optional description of the object. A meaningful description helps
you remember the differences between your events when you are
viewing them in a list.
Deployment Status
Indicates whether the platform event is visible to other users.
Custom Fields
In addition to the standard fields, add custom fields to customize your event. Platform event custom fields support only these field types.
• Checkbox
• Date
• Date/Time
• Number
• Text
• Text Area (Long)
ReplayId System Field
Each event message is assigned an opaque ID contained in the ReplayId field. The ReplayId field value, which is populated by
the system, refers to the position of the event in the event stream. Replay ID values are not guaranteed to be contiguous for consecutive
events. For example, the event following the event with ID 999 can have an ID of 1,025. A subscriber can store a replay ID value and use
it on resubscription to retrieve events that are within the retention window. For example, a subscriber can retrieve missed events after
a connection failure. Subscribers must not compute new replay IDs based on a stored replay ID to refer to other events in the stream.
355
Extend Salesforce with Clicks, Not Code
Deliver Custom Notifications with Platform Events
Note: Each platform event also contains the ID system field. The ID isn’t used to retrieve stored events. The ID value is unique
within your org.
API Name Suffix for Platform Events
When you create a platform event, the system appends the __e suffix to create the API name of the event. For example, if you create
an event with the object name Low Ink, the API name is Low_Ink__e. The API name is used whenever you refer to the event
programmatically, for example, in Apex.
Apex Trigger Subscribers
The Subscriptions related list shows all the active triggers that are subscribed to platform events. The list shows the replay ID of the event
that the system last processed and the event last published. Knowing which replay ID was last processed is useful when there is a gap
in the events published and processed. For example, if a trigger contains complex logic that causes a delay in processing large batches
of incoming events.
Also, the Subscriptions list shows the state of each subscribed trigger. Trigger states can be one of the following.
• Running—The trigger is actively listening to events.
• Idle—The trigger hasn't received events for some time and is not actively listening to events. When new events are sent, the
trigger receives the new events after a short delay and switches to the Running state.
• Error—The trigger has been disconnected and stopped receiving published events. A trigger reaches this state when it exceeds
the number of maximum retries with the EventBus.RetryableException. Trigger assertion failures and unhandled
exceptions don’t cause the Error state. To resume trigger execution, fix the trigger code and save it.
• Suspended—The trigger is disconnected and can’t receive events due to lack of permissions.
• Expired—The trigger’s connection expired. In rare cases, subscriptions can expire if they’re inactive for an extended period of
time.
Also, information about event subscribers is exposed in the EventBusSubscriber object. You can query this object to obtain details about
subscribers.
Platform Event Considerations
Field-Level Security
All platform event fields are read only by default, and you can’t restrict access to a particular field. Because platform events aren’t
viewable in the Salesforce user interface and aren’t editable, field-level security permissions don’t apply.
Platform Encryption
Platform Encryption is not supported for Platform Event fields.
Enforcement of Field Attributes
Platform event records are validated to ensure that the attributes of their custom fields are enforced. Field attributes include the
Required and Default attributes, the precision of number fields, and the maximum length of text fields.
Permanent Deletion of Event Definitions
When you delete an event definition, it’s permanently removed and can’t be restored. Before you delete the event definition, delete
the associated triggers. Published events that use the definition are also deleted.
Renaming Event Objects
Before you rename an event, delete the associated triggers. If the event name is modified after clients have subscribed to notifications
for this event, the subscribed clients must resubscribe to the updated topic. To resubscribe to the new event, add your trigger for
the renamed event object.
356
Extend Salesforce with Clicks, Not Code
Automate Your Business Processes
No Associated Tab
Platform events don’t have an associated tab because you can’t view event records in the Salesforce user interface.
No SOQL Support
You can’t query event notifications using SOQL.
No Record Page Support in Lightning App Builder
When creating a record page in Lightning App Builder, platform events that you defined show up in the list of objects for the page.
However, you can’t create a Lightning record page for platform events because event records aren’t available in the user interface.
Platform Events in Package Uninstall
When uninstalling a package with the option Save a copy of this package's data for 48 hours after uninstall enabled, platform
events aren’t exported.
No Support in Professional and Group Editions
Platform events aren’t supported in Professional and Group Edition orgs. Installation of a package that contains platform event
objects fails in those orgs.
SEE ALSO:
Platform Events Developer Guide
Automate Your Business Processes
Instead of relying on your users to perform each part of a business process, automate it! The benefits are two-fold: your users can spend
their time on other tasks, and you can trust that the process is always done just so. Salesforce offers tools to automate several kinds of
business processes: workflow processes, approval processes, wizard-based processes, and more. You'll be happy to know that these
tools don't require you to write code—they're all point-and-click.
Which Automation Tool Do I Use?
Salesforce provides multiple tools to automate your organization’s repetitive business processes: Approvals, Process Builder, Workflow,
and Visual Workflow.
Lightning Process Builder
Many of the tasks you assign, the emails you send, and other record updates are vital parts of your standard processes. Instead of
doing this repetitive work manually, you can configure processes to do it automatically. Process Builder helps you automate your
business processes and gives you a graphical representation as you build it.
Visual Workflow
Visual Workflow lets you automate business processes by building flows and distributing them to the right users or systems. A flow
is an application that can execute logic, interact with the Salesforce database, call Apex classes, and collect data from users. You can
build flows by using the Cloud Flow Designer.
Workflow
Workflow lets you automate standard internal procedures and processes to save time across your org. A workflow rule is the main
container for a set of workflow instructions. These instructions can always be summed up in an if/then statement.
Approvals
It’s likely that you’re familiar with process automation in the form of workflow rules. Approvals take automation one step further,
letting you specify a sequence of steps that are required to approve a record.
357
Extend Salesforce with Clicks, Not Code
Which Automation Tool Do I Use?
Perform Automated Actions
An automated action is a reusable component that performs some sort of action behind the scenes—like updating a field or sending
an email. Once you create an automated action, add it to a process, milestone, or other automated process.
Which Automation Tool Do I Use?
Salesforce provides multiple tools to automate your organization’s repetitive business processes:
Approvals, Process Builder, Workflow, and Visual Workflow.
EDITIONS
The best automation tool for your needs depends on the type of business process that you’re
automating.
Available in: Lightning
Experience and Salesforce
Classic
• How a record gets approved
Example: Managers approve their direct reports’ requests for vacation.
• What to do when a record has certain values
Example: Notify the account owner when a related case is escalated.
• Collecting information from users or customers and then doing something with that information
Example: Customer support uses a wizard to step through a call script, and cases are created
based on the information that they enter.
Processes are available in:
Professional, Enterprise,
Performance, Unlimited,
and Developer Editions
Flows, approvals, and
workflow are available in
Enterprise, Performance,
Unlimited, and Developer
Editions
How a Record Gets Approved
For example, when an employee requests time off, that time has to be approved by the employee’s manager. You need to ensure that
when a time-off request is submitted for approval, the right person (the employee’s manager) receives the request.
To automate your organization’s processes for approving records, create approval processes.
What to Do When a Record Has Certain Values
Three of our tools can address this use case: Workflow, Process Builder, and Visual Workflow. Respectively, these tools create workflow
rules, processes, and flows.
We recommend starting with Process Builder, especially for business processes that can be simplified to if/then statements. For example:
if a case is escalated, then notify the account owner.
Process Builder includes almost all the functionality that’s available in workflow rules, and more. In fact, a single process can do what it
would normally take multiple workflow rules to do. The only thing you can do with workflow that you can’t do with processes is send
outbound messages without code. However, you can work around this limitation by calling Apex code from a process.
If the process is too complicated for the Process Builder or requires more advanced functionality, create a flow by using Visual Workflow.
For example, create a flow to:
• Use complex branching logic (if certain conditions are true, evaluate for further conditions)
Example: First, check whether a case is escalated. If the case is escalated, check the account’s region and route the case accordingly.
• Sort through, iterate over, and operate on several records
Example: After an opportunity is closed and won, calculate the opportunity’s discount. Then apply that discount to all the related
opportunity products.
358
Extend Salesforce with Clicks, Not Code
Which Automation Tool Do I Use?
Getting Information from Users or Customers and Then Doing Something with It
If you need to build a wizard to collect information, Visual Workflow is the tool for you. Create a flow that displays information to and
requests information from a user. Then take the information that they enter and perform actions in Salesforce with it.
For example, create a flow that walks customer support representatives through a call script. The flow uses information that the
representative entered, such as the caller’s name and account number, to create a case that’s assigned to the right person.
You can add more complexity to the flow to match your business process. For example:
• Route the representative to different screens, depending on earlier choices. This prevents the representative from doing things like
trying to upsell a product to a customer who already bought that product.
• Check whether the reported problem is blocking the customer’s business and the account is high-value. If so, the flow notifies the
region director.
Automation Tool Features
Here’s the breakdown of all the features and actions that are supported in each of our automation tools. Use it to figure out which tool
is best for your business needs.
Complexity
Process Builder
Visual Workflow
Workflow
Approvals
Multiple if/then
statements
Complex
A single if/then
statement
A single if/then statement
All (Chrome
recommended)
All (Safari not recommended)
All
All
Visual designer
Browser support
Starts when
• Record is
changed
• User clicks button or link
• Invoked by
another process
• Process starts
Record is changed • User clicks button or link
• User accesses custom tab
• Process or flow starts that
includes a Submit for
Approval action
• Apex is called
• Apex is called
Supports
time-based
actions
Supports user
interaction
Supported Actions
Call Apex code
Create records
Tasks only
Invoke processes
Delete records
Launch a flow
359
Tasks only
Extend Salesforce with Clicks, Not Code
Process Builder
Lightning Process Builder
Visual Workflow
Workflow
Approvals
(Pilot)1
Post to Chatter
Send email
(Email alerts only)
(Email alerts only)
(Email alerts only)
The record or its
parent
The record or its parent
Send outbound
messages without
code
Submit for
approval
Update fields
Any related record
Any record
1
The Process Builder has superseded flow trigger workflow actions, previously available in a pilot program. Orgs that are using flow
trigger workflow actions can continue to create and edit them, but they aren’t available for new orgs.
Lightning Process Builder
Many of the tasks you assign, the emails you send, and other record updates are vital parts of your
standard processes. Instead of doing this repetitive work manually, you can configure processes to
do it automatically. Process Builder helps you automate your business processes and gives you a
graphical representation as you build it.
Process Builder supports three types of processes for your automation needs. The type determines
what triggers the process.
• A record change process starts when a record is created or updated.
• An event process starts when a platform event occurs.
• An invocable process starts when something else, like another process, invokes it.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Each process consists of:
• Criteria that determine when to execute an action group.
• Action groups, which consist of immediate or scheduled actions. Only record change processes support scheduled actions.
Process Builder vs. Workflow
Use the more powerful and flexible Process Builder to perform the same actions as Workflow. With Process Builder, you can:
• Create a record of any object type
• Update any related record—not just the record or its parent
• Use a quick action to create a record, update a record, or log a call
360
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
• Invoke a process from another process
• Launch a flow—you can’t schedule this action with workflow
• Send an email
• Post to Chatter
• Submit a record for approval
If you need your process to do more than what process actions allow, don’t worry. You can also call Apex or a flow from a process.
Sample Process: Opportunity Management
This example automates a single business process by using the Process Builder instead of workflow rules.
Sample Process: Printer Management
The example demonstrates how you can use Process Builder to subscribe to and evaluate a platform event.
Process Limits and Considerations
Before you start creating, managing, and activating processes, understand the limits and considerations.
Setting Values in the Process Builder
Throughout the Process Builder, you need to set values, for example, to set conditions in a criteria node, to set the fields on a new
case in a Create a Record action, or to specify an Apex method to reference.
Setting Advanced Options in the Process Builder
The Process Builder lets you choose some advanced options for executing actions in your processes.
Create a Process
To create a process, define its properties and which records it should evaluate, and then add criteria nodes and actions.
Troubleshoot Processes
Use the error messages that appear in the Process Builder and the emails you receive when a process fails to help solve problems
that arise when you’re working with processes. When all else fails, look at the Apex debug logs for your processes.
SEE ALSO:
Which Automation Tool Do I Use?
Sample Process: Opportunity Management
This example automates a single business process by using the Process Builder instead of workflow
rules.
EDITIONS
The example demonstrates how you can use the Process Builder to automate a single process by
adding multiple groups of criteria and then associating individual actions with those criteria. In
addition, some actions are available with the Process Builder that you can’t perform with workflow
rules, such as creating records.
Available in: both Salesforce
Classic and Lightning
Experience
In this example, the process is defined to start when an opportunity record (1) is created or edited.
Three criteria nodes are then set up to check whether a high-value deal was won (2), a high-value
deal was lost (3), or a quote was given (4). For the first criteria node that evaluates to true, the
associated action group is executed.
361
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
The High Value Deal Won criteria checks whether the opportunity’s stage is closed and won and also whether the opportunity’s amount
is greater than $1,000,000.00. If both of these conditions are met, the associated action group is executed. For this criteria node, three
immediate actions (5) and one scheduled action (6) are defined.
These actions:
• Create a draft contract record that's associated with the opportunity’s account.
• Congratulate the opportunity owner for closing and winning the opportunity by posting to the Sales Chatter group.
• Notify the VP of sales via email that the opportunity was closed and won.
• Create a high priority follow-up task for the associated account’s owner, which is scheduled to execute six days after the opportunity’s
Close Date.
If the High Value Deal Won criteria conditions aren’t met, the associated group of actions doesn’t execute and the next criteria node
(High Value Deal Lost) is evaluated.
The High Value Deal Lost criteria node checks whether the opportunity stage is closed and lost and whether the opportunity amount
is greater than or equal to $1,000,000.00. If these conditions are true, we’ve set up an action (7) to notify the VP of sales by creating a
chatter post on the opportunity record. The post identifies the opportunity and the opportunity amount that was lost.
If neither of the previous criteria conditions are met, the next criteria node defined in this process checks whether the opportunity stage
is set to “Proposal/Quote Given.” If this condition is true, a scheduled action (8) is executed three days after the record is updated. The
scheduled action creates a follow-up task for the opportunity owner to make a call to inquire about the opportunity.
Using the Process Builder, we’ve combined three criteria nodes and associated actions into a single, automated process. To automate
the same business process with workflow, you would have to create three different workflow rules and use Apex triggers to create the
contract record and post to the Sales Chatter group.
362
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Sample Process: Printer Management
The example demonstrates how you can use Process Builder to subscribe to and evaluate a platform
event.
EDITIONS
Using platform events and the Salesforce REST API, your printer publishes a Printer Status event at
the end of each work day. This event includes the printer’s serial number, how much ink and paper
it has, and how many pages it has printed in total.
Available in: both Salesforce
Classic and Lightning
Experience
When Salesforce receives the Printer Status event, your Printer Management process uses the serial
number to find a matching asset in your Salesforce org.
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
If the process finds a match, it evaluates the event’s data.
• The first criteria always update the asset’s print count.
• The second criteria checks if the ink is low. If so, it launches a flow that orders more ink and assigns a service technician to install the
ink cartridge.
• The third criteria checks if the paper is low. If so, it launches a flow that orders more paper and assigns a service technician to add
the paper.
363
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
SEE ALSO:
Platform Events Developer Guide: Considerations
Process Limits and Considerations
Before you start creating, managing, and activating processes, understand the limits and
considerations.
Process Limits
When building processes, keep shared limits and Apex governor limits in mind. In addition, a
process’s API name must be unique across all processes and flows in your org.
When Do Processes Evaluate Record Changes?
Processes start automatically and are invisible to the user. Before you design or activate a process,
understand which changes trigger processes.
364
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Considerations for Designing Processes
Before you design a process, understand the limitations and guidelines.
Considerations for Managing Processes
Understand what happens when you install, activate, or delete processes.
Considerations for Deploying Processes
Keep these considerations in mind when deploying processes, such as when using packages or change sets.
Process Limits
When building processes, keep shared limits and Apex governor limits in mind. In addition, a
process’s API name must be unique across all processes and flows in your org.
EDITIONS
Limits Shared with Other Features
Available in: both Salesforce
Classic and Lightning
Experience
Processes share some limits with rules and flows.
Description
Per-Org Limit
Total number of active rules and active processes per object
50
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Rules include workflow rules, escalation rules, assignment rules, and
auto-assignment rules. Invocable processes don’t count toward this limit.
Total number of flows and processes (including event processes)
1,000
Total number of active flows and processes (including event processes)
500
Total number of event processes
500
Total number of active event processes
50
Total number of criteria nodes that are evaluated and actions that are
executed at runtime
2,000
Total number of flow interviews that are resumed or groups of scheduled
actions that are executed per hour
1,000
Total number of flow interviews or groups of scheduled actions that are
waiting to be processed
30,000
Total number of relative time alarms defined in flow versions or schedules 20,000
based on a field value in processes
The daily limit for emails sent from email alerts is 1,000 per standard Salesforce license per org, except for Developer Edition orgs. For a
Developer Edition org, the daily workflow email limit is 15 per standard Salesforce license. The overall org limit is 2,000,000, which is
shared across all features that use workflow email alerts: workflow rules, approval processes, flows, and processes.
Apex Governors and Limits for Processes
Salesforce strictly enforces limits to ensure that runaway processes don’t monopolize shared resources in the multitenant environment.
Processes are governed by the per-transaction limits that are enforced by Apex. If the process causes the transaction to exceed governor
365
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
limits, the system rolls back the entire transaction. For details about the operations that are included in the transaction, see “Triggers
and Order of Execution” in the Apex Developer Guide.
Description
Per-Transaction Limit
Total number of SOQL queries issued
100
Total number of records retrieved by SOQL queries
50,000
Total number of DML statements issued
150
Total number of records processed as a result of DML statements
10,000
Each Create a Record action uses one DML statement. Each Quick Action action uses one DML statement. Each Update Records action
uses one SOQL query and one DML statement. Each Flows action can use multiple SOQL queries and DML statements, depending on
the elements that the flow executes. For details, see Limits for Visual Workflow on page 419.
Limits for Creating and Managing Processes
Consider these limits when creating and managing processes.
Description
Limit
Total number of characters in a process name
255
Total number of characters in a process’s API name
77
Total number of versions of a process
50
Total number of criteria nodes in a process
200
When Do Processes Evaluate Record Changes?
Processes start automatically and are invisible to the user. Before you design or activate a process,
understand which changes trigger processes.
EDITIONS
A record change can apply to more than just processes. When a record is created or edited, Salesforce
evaluates whether to run other setup items, such as validation rules on the record. Salesforce
evaluates the setup items in this order.
Available in: both Salesforce
Classic and Lightning
Experience
1. Validation rules
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
2. Assignment rules
3. Auto-response rules
4. Workflow rules and processes (and their immediate actions)
5. Escalation rules
For more information, see Triggers and Order of Execution in the Apex Developer Guide.
When you create a process, you associate the process with exactly one object. You also specify whether to evaluate only created records
or both created and edited records. When you activate a process, it starts when a record change meets those settings.
Processes Evaluate Record Changes When:
• A record is saved or created. Processes that are created after records are saved don’t evaluate those records retroactively.
366
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
• A standard object in a master-detail relationship is reparented.
• Users synchronize records that were changed while using Connect Offline.
• Leads are converted, if the lead setting Require Validation for Converted Leads is enabled.
• Another process, workflow rule, or flow updates the record in the same transaction, if the process is configured to reevaluate
records.
Processes can reevaluate records up to five times in one transaction. In a batch update, processes reevaluate only changed
records.
Note: A record change can trigger more than one process. You can’t determine which process starts first.
Processes Don’t Evaluate Record Changes When:
• Campaign statistic fields, such as individual campaign statistics or campaign hierarchy statistics, are updated.
• Picklist values are mass replaced.
• Address fields are mass updated.
• Divisions are mass updated.
• Territory assignments of accounts and opportunities are modified.
• Self-Service Portal, Customer Portal, or partner portal users are deactivated.
• State and country data are converted with the Convert tool.
• Values for state and country picklists are modified using AddressSettings in the Metadata API.
Considerations for Designing Processes
Before you design a process, understand the limitations and guidelines.
Tip:
We recommend that you use the most recent stable version of Google Chrome™.
Best Practices for Designing Processes
Before you design a process, understand the best practices.
Process Builder Accessibility Considerations
Process Builder is 508-compliant, with one exception. You can’t close modal dialogs with your
keyboard.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Considerations for Event Processes
These considerations are specific to processes that start when a platform event occurs.
Compatibility Considerations for Processes
Before you design a process, understand how processes interact with other Salesforce features, like custom objects and fields.
Process Formula Limitations
Formulas that are used as conditions in a criteria node have some limitations. If a process contains an invalid formula, you can’t save
or activate the process.
Considerations for Scheduling Process Actions
Scheduled actions are supported only in processes that start when a record changes. The record is processed according to the type
of schedule, whether the field changed, and whether the process was deactivated.
Considerations for Processes That Post to Chatter
The Post to Chatter action doesn’t support communities, and there are some limitations around what you put in the message.
367
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Considerations for Processes That Update Records
Understand what happens when you change a record owner, update the same field multiple times, or update currency fields in a
multiple currency org.
Best Practices for Designing Processes
Before you design a process, understand the best practices.
EDITIONS
• For an object, use either workflow rules or processes. If you use both, you can’t predict the order
in which they’re executed.
• Make sure that your processes don’t generate infinite loops.
For example, an Update Records action for Process1 triggers Process2, and a Create a Record
action for Process2 triggers Process1. The looping causes your org to exceed its hourly limits.
• If you replace a workflow rule with a process, deactivate the workflow rule when you activate
the process. Otherwise, you can get unexpected results, such as overwritten records or redundant
email messages. This best practice also applies to Apex triggers.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Process Builder Accessibility Considerations
Process Builder is 508-compliant, with one exception. You can’t close modal dialogs with your
keyboard.
EDITIONS
Close UI Elements with the Esc key
Available in: both Salesforce
Classic and Lightning
Experience
You can close modal dialogs using the Esc key on your keyboard, but you can’t close side panels.
Reorder Criteria Nodes
To reorder criteria nodes with your keyboard:
1. Select a criteria node by pressing the Space key.
2. Change the order of a criteria node by using the Up and Down arrow keys.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
3. Save your changes by pressing the Space key.
4. Cancel by pressing the Esc key.
Considerations for Event Processes
These considerations are specific to processes that start when a platform event occurs.
Formulas
You can’t add merge fields from platform events to a formula.
Post to Chatter Actions
You can’t include event references in Chatter post messages.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
Scheduled Actions
Scheduled actions aren’t supported.
Associating with a Record
Use the process’s matching conditions to find exactly one record. If the process can’t find one
record based on your matching conditions—because either it found multiple records or no records—the creator of the process
receives an error email. If an error occurs, adjust the conditions in the process’s trigger to be more specific.
368
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Creating Event Messages
With event processes, we don’t block you from creating the same event message that starts the process. To avoid creating an endless
loop, make sure that the new event message’s field values don’t meet the filter criteria for the associated criteria node.
Subscriptions Related List
On the platform event’s detail page, the Subscription related list shows which entities are waiting for notifications of that platform
event to occur. If active event processes are associated with the platform event, a “Process” subscriber appears in the Subscriptions
related list.
Packaging
When you package an event process, the associated object isn’t automatically included. Advise your subscribers to create the object
or manually add the object to your package. For example, when you package an event process that’s associated with the Participants
custom object, manually add the object to your package.
Uninstalling Events
Before you uninstall a package that includes a platform event, deactivate all processes that reference the event.
Testing Events
Event processes subscribed to platform events don't support Apex tests.
Compatibility Considerations for Processes
Before you design a process, understand how processes interact with other Salesforce features, like
custom objects and fields.
EDITIONS
Objects
Process Builder doesn’t support:
Available in: both Salesforce
Classic and Lightning
Experience
• Deprecated custom objects
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• External objects
• Signup Request — unsupported in schedules only
• Social Post
• Social Persona
Custom Fields
• Process Builder doesn’t support custom fields of type File.
• If a process references a custom field:
– You can’t delete the field.
– If you change the field type or name, the process breaks.
– If you change the field label, the process doesn’t break. But it still uses the original label.
Shield Platform Encryption
You can’t use an encrypted field as a filter in an Update Records action.
Validation Rules
• Immediate Update Records actions obey validation rules.
• Scheduled Update Records actions skip validation rules.
Duplicate Rules
If a duplicate is found when a process tries to create or update a record, the process fails.
Converted Leads
To evaluate records that result from converted leads, enable the lead setting Require Validation for Converted Leads.
369
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Formula Field Values
If a standard formula field references a field on a related object, that field's value is always null when a process starts. This limitation
doesn’t apply to custom formula fields that reference a field on a related object. For a custom formula field that uses the same
formula, the field’s value is derived when a process starts.
For example, the RevenueShare field on Campaign Influence calculates CampaignInfluence.Opportunity.Amount
* CampaignInfluence.Influence. Because the formula references a field on Opportunity (a related object), the field’s
value is null.
Process Formula Limitations
Formulas that are used as conditions in a criteria node have some limitations. If a process contains
an invalid formula, you can’t save or activate the process.
EDITIONS
All formulas that are used in a criteria node must:
Available in: both Salesforce
Classic and Lightning
Experience
• Return true or false. If the formula returns true, the associated actions are executed.
• Not contain more than 3,000 characters.
• Not contain an unsupported function.
• Reference the process trigger object for that process.
• Use the correct capitalization when referring to the process trigger object.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Tip: Parentheses aren’t included automatically when you insert a function. Be sure to add
parentheses, for example, TODAY(), when building a formula.
You can’t add merge fields from platform events to a formula.
Unsupported Functions
If a formula in a process uses any of the following functions, the formula returns null.
• GETRECORDIDS
• IMAGE
• INCLUDE
• PARENTGROUPVAL
• PREVGROUPVAL
• REQUIRE SCRIPT
• VLOOKUP
For a complete list of operators and functions for building formulas in Salesforce, see Formula Operators and Functions on page 256.
Note:
• If your process criteria uses a formula, don’t create a formula that always evaluates to true, such as 2 < 5.
370
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
• ISCHANGED is available as both a formula function and as an operator. When it’s used as a formula function in process criteria,
you can’t reference a child record’s related fields. For example, ISCHANGED isn’t supported when referencing a
[Case].Contact.AccountId field, but it can be used when referencing [Case].ContactId.
SEE ALSO:
Tips for Working with Picklist and Multi-Select Picklist Formula Fields
Process Builder Advanced Option Considerations
Tips for Working with Picklist and Multi-Select Picklist Formula Fields
Considerations for Scheduling Process Actions
Scheduled actions are supported only in processes that start when a record changes. The record is
processed according to the type of schedule, whether the field changed, and whether the process
was deactivated.
Process Schedule Limitations
Before you add a schedule to a process, understand the limits and what isn’t supported.
How Does Salesforce Process Scheduled Actions?
Understand the expected behavior for processing scheduled actions based on which type of
schedule they’re associated with, whether the field changed, and whether the process was
deactivated.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Transactions and Scheduled Actions
Immediate actions in processes are executed in the same transaction as the operation that triggered the process—that is, when a
user created or edited a record. Scheduled actions are included in a separate transaction.
Process Schedule Limitations
Before you add a schedule to a process, understand the limits and what isn’t supported.
• Across all versions, your org can have up to 20,000 process schedules based on a field and flow
wait events based on relative time alarms.
• If an action group contains scheduled actions, you can’t continue evaluating the next criteria
in your process after executing those actions.
• SignupRequest processes don’t support scheduled actions.
• Field-based schedules can’t reference a Date or Date/Time field that contains automatically
derived functions, such as TODAY or NOW.
• Field-based schedules can’t reference a formula field that includes related-object merge fields.
• If you add a schedule for 0 Days Before a date, when you later reopen the process, the schedule
changes to 0 Days After the date. The process still executes at the specified time.
371
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
How Does Salesforce Process Scheduled Actions?
Understand the expected behavior for processing scheduled actions based on which type of
schedule they’re associated with, whether the field changed, and whether the process was
deactivated.
Limits for Processing Scheduled Actions
• An org can process up to 1,000 groups of scheduled actions per hour.
Each group of scheduled actions is associated with a schedule, such as “3 days from now.” When
a schedule is processed, the associated actions are executed. If an org exceeds this limit,
Salesforce processes the remaining schedules in the next hour.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
For example, an org has 1,200 groups of pending actions scheduled to be processed between
4:00 and 5:00 PM. Salesforce processes 1,000 groups between 4:00 and 5:00 PM, and it processes the remaining 200 groups between
5:00 and 6:00 PM.
• An org can have up to 30,000 pending schedules and waiting flow interviews at one time.
Schedules Based on the Current Time
For example: 3 days from now.
The schedule is evaluated based on the time zone of the user who created the process.
Schedules Based on a Field Value
For example: 3 days after a case’s Created Date.
• The schedule is evaluated based on the org’s time zone.
• If the schedule references a null field value, Salesforce ignores that schedule.
• If actions are scheduled for a time in the past, Salesforce executes that group of scheduled actions within 1 hour.
For example, a process is configured to email an opportunity owner 7 days before the close date. The process runs for an opportunity
with the close date set to today, so Salesforce executes the scheduled actions within an hour.
• If you schedule an action for 0 Days After a date, a delay can occur from the time represented by the date field before the action
group executes.
Limitations for Converted Leads
• You can’t convert a lead when an unexecuted schedule is based on one of the lead’s fields.
• If Validation and Triggers from Lead Convert is enabled, scheduled actions on leads aren’t executed during lead conversion.
• If a lead is converted into a campaign member before the associated scheduled actions finish, Salesforce still executes the
scheduled actions.
What Happens When the Field Values Change?
• For processes that start when a record is created or edited, scheduled actions remain in the queue only as long as the criteria
for those actions are still valid. If a record no longer matches the criteria, Salesforce removes the scheduled actions for the record
from the queue.
• For processes that start when a record is created, Salesforce never reevaluates the record with that process. Scheduled actions
remain in the queue, even if the record no longer meets the associated criteria when the scheduled actions are executed.
• If you change the referenced field value and the schedule hasn’t been processed, Salesforce recalculates the schedule associated
with the field.
372
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
For example, a process is configured to email an opportunity owner 7 days before the opportunity close date. The close date is
set to 2/20/2014. Salesforce processes the schedule on 2/13/2014 and sends the email. If the close date is later updated to
2/10/2014 and the schedule hasn’t been processed yet, Salesforce recalculates the schedule and sends the email on 2/3/2014.
If Salesforce recalculates the schedule to a date in the past, it executes the associated actions shortly after you save the record.
• If the record or object that the schedule is associated with is deleted, Salesforce never processes the schedule.
What Happens When the Associated Process Is Deactivated?
After you deactivate a process, the scheduled actions continue as usual. If a deactivated process has pending scheduled actions and the
record whose field the schedule is based on is changed, Salesforce recalculates the schedule for those actions.
Once a process is deactivated, Salesforce ignores all other changes to associated records.
What Happens When Scheduled Actions Fail?
If scheduled actions fail—for example, because the user who caused the process to start is inactive—the admin who created the process
receives an email with details about the failure. Salesforce makes additional attempts to execute failed scheduled actions before removing
them from the queue.
Transactions and Scheduled Actions
Immediate actions in processes are executed in the same transaction as the operation that triggered
the process—that is, when a user created or edited a record. Scheduled actions are included in a
separate transaction.
Scheduled actions aren’t performed independently. They’re batched together with other actions
that are scheduled to execute at the same time. A batch can include actions from other processes
or flows that are scheduled by other users. This behavior can cause you to exceed your Apex governor
limits if the batch's actions execute DML operations or SOQL queries.
A DML operation is used each time a Salesforce record is created, updated, or deleted, such as when
a process executes a Create a Record action. A SOQL query is used each time Salesforce looks up
information about an existing record, such as when a process executes an Update Records action.
For details on Apex governor limits, see Process Limits on page 365.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Tip: Design a process with a scheduled action so it doesn't exceed limits when it executes in a batch. For example, a process has
a scheduled action that triggers a SOQL query. If the action executes in a batch of 100 other actions and they each trigger a SOQL
query at the same time, the process fails because the batch exceeds the Apex governor limit of 100 SOQL queries per hour.
If a group of scheduled actions fails to be executed:
• Prior groups of scheduled actions in that batch’s transaction are successful.
• The immediate actions for that process are successful.
• All scheduled actions in that group aren’t executed.
• The remaining groups of scheduled actions in that batch are tried.
Example: Salesforce is going to process a batch of 25 groups of scheduled actions in the same transaction. Up to 100 DML
operations can be used across this batch. The first 22 groups each use five DML operations, and the remaining three groups don’t
use any DML operations.
The 21st group violates the Apex governor limits by trying to execute the 101st through 105th DML operations for this transaction.
The first 20 groups of scheduled actions are successfully executed, but the 21st group of scheduled actions fails. None of its actions
are successful, no matter which action in the group violated the limit. Salesforce then tries to execute the remaining groups of
scheduled actions in the batch. Because the 22nd group uses five DML operations and the transaction has already used all its
373
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
allowed DML operations, the 22nd group also fails. Because the last three groups don’t use DML operations, those groups are
successfully executed.
Considerations for Processes That Post to Chatter
The Post to Chatter action doesn’t support communities, and there are some limitations around
what you put in the message.
EDITIONS
Unsupported Feeds
Processes can’t post to a Community user or group.
Available in: both Salesforce
Classic and Lightning
Experience
Chatter Message
• You can add up to 25 @mentions to a Chatter message.
• If you use Microsoft® Internet Explorer® version 11, you can’t paste text into a message. Copy
and paste actions are allowed in all other supported browsers.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• Don’t start the message with a field reference, such as {![Account].Name}. Otherwise,
the action fails to save. To work around this issue, add a space at the beginning of the
message.
Deploying Processes That Post to Chatter
If your process posts to the Chatter feed of a specific user or group, the process runs only in the source org. The IDs referenced by
the Post to Chatter action don’t exist in the target org.
Considerations for Processes That Update Records
Understand what happens when you change a record owner, update the same field multiple times,
or update currency fields in a multiple currency org.
EDITIONS
Updating a Record’s Owner
Processes that update owners don’t automatically transfer the associated items. Use an Update
Records action for each type of child record that you want to transfer.
Available in: both Salesforce
Classic and Lightning
Experience
For example, you want to transfer an account to a new owner. Add four Update Records actions
to your process. The first updates the account. The second updates the child contacts. The third
updates the child opportunities. And the fourth updates the child contracts.
Multiple Updates to the Same Field
If multiple Update Records actions apply different values to the same field, the last action’s
value is used.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Multiple Currencies
If your org uses multiple currencies, the currency fields are updated using the record’s currency code. If you use a formula to update
a field, the formula values use the record’s currency code.
374
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Considerations for Managing Processes
Understand what happens when you install, activate, or delete processes.
Installed Processes
If you installed a process from a managed package, you can only activate it or deactivate it. You
can’t view or edit the process.
Active Processes
After you activate a process, you can no longer edit it.
Deleting Processes
You can’t delete a process when it has unexecuted groups of scheduled actions. The workaround
is to delete the unexecuted groups of unscheduled actions on page 407.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Considerations for Deploying Processes
Keep these considerations in mind when deploying processes, such as when using packages or
change sets.
EDITIONS
Processes That Reference Other Components
If you deploy a process that contains any of the following actions, the corresponding components
aren’t included in the package or change set automatically. To deploy successfully, manually
add the referenced components to the package or change set.
Available in: both Salesforce
Classic and Lightning
Experience
• Apex
• Email Alerts
• Launch a Flow
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• Post to Chatter
• Quick Actions
• Submit for Approval
Metadata API
• If the process already exists in the target org, it must be inactive. Otherwise, the process fails to deploy.
• If the process doesn’t exist in the target org, it deploys with an inactive status, regardless of its status in the source org.
Deploying Processes That Post to Chatter
If your process posts to the Chatter feed of a specific user or group, the process runs only in the source org. The IDs referenced by
the Post to Chatter action don’t exist in the target org.
Setting Values in the Process Builder
Throughout the Process Builder, you need to set values, for example, to set conditions in a criteria
node, to set the fields on a new case in a Create a Record action, or to specify an Apex method to
reference.
Field Picker
Use the field picker to reference fields on the record that started the process or fields on related
records.
Process Builder Value Types
When setting a value for a given field—whether on the record that started the process or a
related record— the available value types are filtered based on the field that you’ve selected.
375
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Multi-Select Picklists in the Process Builder
The Process Builder lets you select multiple values for a multi-select picklist field.
Field Picker
Use the field picker to reference fields on the record that started the process or fields on related
records.
EDITIONS
To use fields on a related record, click a field with
ID field value on the case’s contact’s account.
Available in: both Salesforce
Classic and Lightning
Experience
next to the value. For example, use the Account
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
The field picker displays only fields that are compatible with the selected parameter.
If you see a field multiple times, that means the field can relate to multiple objects. For example, if you created a queue for cases, a case’s
owner can be either a user or a queue. Owner ID is a polymorphic field—a field that relates to more than one object.
To access a field on the case’s owner, choose the appropriate relationship. Be careful, though. If you pick Owner ID (User) and the owner
of the record is actually a queue, the process fails.
376
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Process Builder Value Types
When setting a value for a given field—whether on the record that started the process or a related
record— the available value types are filtered based on the field that you’ve selected.
EDITIONS
The available value types are:
Available in: both Salesforce
Classic and Lightning
Experience
• Currency—Manually enter a currency value.
• Boolean—Choose a true/false boolean value.
• Date/Time or Date—Manually enter a date/time or date value.
• Formula—Create a formula expression.
• Global Constant—Choose a global constant to set a value to null or an empty string—for
example, choose $GlobalConstant.Null.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Note: These global constant values aren’t supported with the is null operator.
– $GlobalConstant.Null
– $GlobalConstant.EmptyString
• ID—Manually enter a Salesforce ID value, for example, 00300000003T2PGAA0.
Note: If your process is based on a user ID (for example, when an [Event].OwnerId equals a specific ID value) make sure that
the ID value is an 18-character ID and not a 15-character ID. You can convert a 15-character ID to 18 characters at
www.adminbooster.com/tool/15to18.
• Multi-Picklist—Choose one or more multi-select picklist values.
• Number—Manually enter a number value.
• Picklist—Choose a picklist value.
• Queue—Search for a specific queue in your org.
• Reference—Choose a field on the record or on a related record.
• String—Manually enter a string value.
• User—Search for a specific user in your org.
Multi-Select Picklists in the Process Builder
The Process Builder lets you select multiple values for a multi-select picklist field.
For example, set multiple values for the Country field for a company record that operates in
Ireland, the UK, and France.
You can use multi-select picklists in:
• Formulas
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• Process criteria
• Create a Record actions
• Quick Actions
• Update Records actions
In process criteria, set multiple values by creating one condition for each individual multi-select picklist value. For example, if your process
checks whether changes were made to an account’s office locations, reference multiple values by choosing the same field for each
multi-select picklist value.
377
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Refer to Tips for Working with Picklist and Multi-Select Picklist Formula Fields for more information.
When you reference a multi-select picklist field in an action, enter values by clicking Choose values…
Add or remove values by dragging them between the Available (1) and Selected (2) columns.
Keep these considerations in mind when using operators with multi-select picklists.
• You can use the Equals operator if you select only one value from a multi-select picklist field.
• If you use the Equals operator with multiple multi-select picklist values and choose the Any of the conditions are met (OR) option,
the condition matches on one value only. For example, if your process checks whether a Region field equals West or East, the condition
evaluates to true when the value is West or when the value is East, but won’t evaluate to true when both West and East are selected
values.
• If you use Contains and OR to evaluate multiple multi-select picklist values, the condition evaluates to true on multiple values. For
example, if your process checks whether a Region field contains West or East, the condition evaluates to true when a Region
field contains West and East or when a Region field contains West or East values.
378
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Setting Advanced Options in the Process Builder
The Process Builder lets you choose some advanced options for executing actions in your processes.
Process Builder Advanced Option Considerations
Keep these considerations in mind when choosing advanced options.
Reevaluate Records in the Process Builder
When you add objects to your process, you can choose to evaluate a record multiple times in
a single transaction.
Nest Processes in the Process Builder
Invocable processes let you modularize sections of your processes and add more logic to them.
An invocable process is process that starts when another process invokes it. Whether a process
is invocable or not is controlled by The process starts when in the process’s properties.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Avoid Unwanted Actions in Processes
When you add criteria to your process, you can choose to execute actions only when specified criteria changes.
Process Builder Advanced Option Considerations
Keep these considerations in mind when choosing advanced options.
• Avoid creating an infinite loop when allowing your process to reevaluate records. For example,
if your process checks whether an account description changes and then updates an account
description and creates a Chatter post every time an account record is created or edited, the
process will evaluate and trigger actions resulting in six Chatter posts.
• If you choose to evaluate a record multiple times in a single transaction when you specify an
object for your process, we recommend not setting any of your criteria to No criteria—just
execute the actions!.
• We recommend that you don’t use the advanced options if your process uses ISCHANGED,
ISNEW, or PRIORVALUE formula functions. If you do use these options, keep these considerations
in mind.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
– When a record is first created, ISNEW evaluates to true throughout a process transaction. If your process uses the ISNEW formula
function and reevaluates a record multiple times in a single transaction, the process may execute actions multiple times.
For example, your process checks whether an account is created or updated.
1. When ISNEW evaluates to true, the process updates the account’s annual revenue and posts to Chatter.
2. When the process updates the account’s annual revenue, the process then reevaluates the record (up to five additional
times) because the record was changed.
Each time the criteria is evaluated, ISNEW evaluates to true. The result is six Chatter posts. This example is true only if the process
is triggered because an account record is created.
– When a record is created, PRIORVALUE returns the current value as the prior value. When a record is updated, PRIORVALUE
returns the field value that was set immediately before the transaction started. If your process uses the PRIORVALUE formula
function and reevaluates a record multiple times in a single transaction, the process may execute actions multiple times. If your
process reevaluates a record multiple times in a single transaction and executes actions only when specified criteria changes,
the prior value returns the values that existed before the record was saved.
For example, your process checks whether an account is created or updated.
379
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
1. When PRIORVALUE([Account].Type) = 'Prospect' evaluates to true, the process updates the account’s
annual revenue and posts to Chatter.
2. When an account is created with Prospect as the account type, the criteria is always true until the end of the process
transaction.
3. If the process is changed to update the account type to Other when the criteria is true, then for an account created with
Prospect as the account type, the formulaPRIORVALUE([Account].Type) = 'Prospect' will be true
until the end of process transaction.
Each time the record is reevaluated, the prior value of the account’s type is Prospect. The result is six Chatter posts.
– ISCHANGED always evaluates to false when a record is first created.
For example, your process checks whether an account description
changes—ISCHANGED([Account].Description)—and the process also reevaluates records multiple times in a
single transaction. If an account is first created with a blank description value and another process updates the account description
in the same transaction, ISCHANGED evaluates to true every time the record is reevaluated because it compares the account
description value when the record was first created (a blank value) with whatever’s set for the current value.
Let’s say this same process creates a Chatter post every time ISCHANGED([Account].Description) evaluates to true. This process
would create a recursive loop resulting in six Chatter posts because ISCHANGED evaluates to true throughout the transaction.
Reevaluate Records in the Process Builder
When you add objects to your process, you can choose to evaluate a record multiple times in a
single transaction.
EDITIONS
It's kind of like using a roundabout instead of a four-way stop to control process traffic. Instead of
stopping and waiting for separate transactions, reevaluating records helps your business traffic flow
a little more freely.
Available in: both Salesforce
Classic and Lightning
Experience
If you choose this option, the process can evaluate the same record up to five additional times in
a single transaction. It might reevaluate the record because a process, workflow rule, or flow updated
the record in the same transaction. When a record is reevaluated, the process uses the most recent
values for that record.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
For example, your sales review process includes multiple steps, approvals, notifications, and fields
that need to be updated. Some of these changes may be part of your process, or they may be
managed by other workflow rules or flows in your organization. If you allow the Process Builder to reevaluate a record multiple times in
a single transaction, you can manage and evaluate all of these changes—even changes from other processes—in a single transaction
in your process.
SEE ALSO:
Process Builder Advanced Option Considerations
380
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Nest Processes in the Process Builder
Invocable processes let you modularize sections of your processes and add more logic to them. An
invocable process is process that starts when another process invokes it. Whether a process is
invocable or not is controlled by The process starts when in the process’s properties.
To invoke a process from another process, you configure a Processes action. That configuration
includes passing a record to the invocable process. That’s how the process knows which record to
start with. Because the record is passed from one process to another, the invocable process receives
a certain version of that record. That version differs, depending on when the Processes action is
executed.
Immediate Action
When you invoke a process through an immediate action, the process receives the values that
the record contained when the top-level process starts.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Example: Process 1 updates an account and then invokes Process 2 based on that account. Process 2 receives the version of the
account when Process 1 started.
Scheduled Action
When you invoke a process through a scheduled action, the process receives the latest values for the record.
Example: Process 1 updates an account and, 15 minutes later, invokes Process 2 based on that account. Process 2 receives the latest
version of the account from the database.
When Should I Build an Invocable Process?
Do you find yourself building the exact same actions for multiple action groups? Configure those actions one time in an invocable
process, and then invoke that process from all the relevant action groups. Later, to update those actions, update the one invocable
process. All the other processes then use the updated actions.
Another cool scenario for invocable processes: nesting simple logic. Processes handle simple “if/then” statements. But what if you need
to nest some of those statements? Rather than having to build a flow or write code, build the second level of logic into another process.
Invoke the second process from the first, and voila!
Example: Let’s say you handle all of your case management in a single process. But you need to treat escalated cases for
high-revenue accounts differently from escalated cases for regular accounts. If the case is escalated by an account whose renewal
date is less than a month away, notify the account owner, the regional manager, and the VP of that region. If the case is escalated
by an account whose renewal date is more than a month away, notify only the account owner and the regional manager.
To do so, you build an invocable process. Let’s call it “Escalated Cases.” The process operates on the Case object and has two criteria
nodes.
• The first criteria node evaluates whether the associated account’s renewal date is less than a month away. When a case meets
that criteria, the process posts to the account’s feed with a link to the case and mentions the account owner, regional manager,
and regional VP.
• The second criteria node has no criteria. If a case doesn’t meet the first node’s criteria, the process performs the same action,
except that it doesn’t mention the regional VP.
Now back to the process that automates your case management. You already have a criteria node that checks whether the case
is escalated. Add a Processes action to that criteria’s action group, and configure the action to invoke the “Escalated Cases” process.
381
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Avoid Unwanted Actions in Processes
When you add criteria to your process, you can choose to execute actions only when specified
criteria changes.
EDITIONS
For example, your process sends an email alert whenever a case has an Escalated status. Let’s say
your support team repeatedly updates the case description with new information. Whenever the
case is saved with a new description, you process can check specifically whether the Escalated
status changed instead of just repeatedly sending email alerts. This way, the process executes
actions only if the status wasn’t set to Escalated and was just changed to Escalated.
Available in: both Salesforce
Classic and Lightning
Experience
Tip: Check out this short video
about this option.
Avoid Unwanted Actions in Your Process to learn more
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
This setting isn’t supported if:
• Your process starts only when a record is created.
• Your process starts when a record is created or edited and the criteria node doesn’t evaluate any criteria.
• The criteria node evaluates a formula, but the formula doesn’t include a reference to the record that started the process.
• Your process uses the Is changed operator in a filter condition.
If Yes is...
Actions are executed if...
Selected
• The record was created.
Deselected
• The record was created.
Actions are not executed if...
• The record’s current values meet the conditions, and
the record’s most recent previous values met the
• The record was updated. Its current values meet the
criteria.
conditions, and its most recent previous values did not
meet the conditions.
• The record’s current values don’t meet the conditions.
The record’s current values don’t meet the conditions.
• The record was updated, and its current values meet
the conditions.
SEE ALSO:
Process Builder Advanced Option Considerations
382
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Create a Process
To create a process, define its properties and which records it should evaluate, and then add criteria
nodes and actions.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
1. Define the Process Properties
The process properties uniquely identify your process.
2. Configure the Process Trigger
Every process includes a trigger, which tells the process when to start. How you configure that
trigger depends on what type of process you’re creating.
3. Add Process Criteria
Define the criteria that must be true before the process can execute the associated actions.
4. Add Actions to Your Process
After you define a criteria node, define the actions that are executed when the criteria are met.
Actions are executed in the order in which they appear in the Process Builder.
5. Execute Actions on More Than One Criteria
Choose whether to stop or continue your process after specific criteria are met and associated
actions execute.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
Define the Process Properties
The process properties uniquely identify your process.
EDITIONS
1. From Setup, enter Builder in the Quick Find box, and select Process Builder.
Available in: both Salesforce
Classic and Lightning
Experience
2. Click New.
3. Define your process by completing the fields.
Field
Description
Process
Name
The name for your process, up to 255 characters.
API Name
This name appears in the process management page, so name your process
so that you can differentiate it from other processes. To see the page, from
Setup, enter Builder in the Quick Find box, then select Process Builder.
The name that the API and managed packages use, up to 79 characters.
This name must be unique across all processes and flows. In flows, this field
is Unique Name. The name must begin with a letter and use only
alphanumeric characters and underscores. It can’t include spaces, end with
an underscore, or have two consecutive underscores.
Important: After it’s saved, you can’t change the process’s API name.
Description Optional. A description for your process.
The description also appears in the process management page. It’s intended
to help you differentiate between processes, such as to explain what a process
does.
383
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Field
Description
The process
starts when
Identifies when the process begins. You can set your process to start when:
• A record changes
• A platform event occurs
• It’s invoked by another process
4. Click Save.
Configure the Process Trigger
Every process includes a trigger, which tells the process when to start. How you configure that
trigger depends on what type of process you’re creating.
Record Change
If the process starts when a record changes, associate the process with an object, and specify
when to start the process.
Event
If the process starts when a platform event occurs, associate the process with a platform event
and an object, and specify matching conditions. Because every process acts on a Salesforce
record, it requires a single record as a starting point. That way, the criteria and actions know
where to start evaluating and executing.
Invocable
If the process starts when another process invokes it, associate the process with an object.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Event processes are
available in: Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
Record Change
If the process starts when a record changes, associate the process with an object, and specify when
to start the process.
1. Click Add Object.
To create, edit, or view
processes:
• Manage Force.com Flow
AND
2. Configure the trigger.
View All Data
For this field Select ...
...
Object
The object that you want to base this process on. Click Find an object. Type
to filter the dropdown list.
Start the
process
Which type of record change triggers the process.
• only when a record is created
• when a record is created or edited
Note: If you’re familiar with workflow rules and you’re wondering
what happened to the third option (created, and any time it’s edited
to subsequently meet criteria), don’t worry! You see that setting when
384
Extend Salesforce with Clicks, Not Code
For this field ...
Lightning Process Builder
Select ...
you add criteria nodes if you selected when a record is created or edited.
Recursion - Allow
process to evaluate a
record multiple times
in a single
transaction?
Yes, if you want the process to evaluate a record multiple times in a single transaction. To see this field,
expand the Advanced area.
When enabled, the process can evaluate the same record up to five more times in a single transaction. It
might reevaluate the record because a process, workflow rule, or flow updated the record in the same
transaction. For more information, see Reevaluate Records in the Process Builder on page 380.
3. Before saving your changes, confirm the selection because you can’t change the object after you save it.
Event
If the process starts when a platform event occurs, associate the process with a platform event and an object, and specify matching
conditions. Because every process acts on a Salesforce record, it requires a single record as a starting point. That way, the criteria and
actions know where to start evaluating and executing.
1. Click Add Trigger.
2. Configure the trigger.
For this field ...
Select...
Platform Event
The platform event that you defined.
Object
The object whose records you want to associate with the event.
Matching Conditions Criteria to identify one record to associate the event with. We recommend using an ID or other field that
uniquely identifies records so the process can pick exactly one record.
The process fails if it finds:
• Multiple records that match the criteria.
• No records that match the criteria.
385
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
3. Before saving your changes, confirm the selection because you can’t change the platform event or object after you save it.
Invocable
If the process starts when another process invokes it, associate the process with an object.
1. Click Add Object.
2. Select an object to associate with the process. Type to filter the dropdown list.
This process can be invoked from any other process as long as the master process passes a record of this object type. For example,
an Account-based invocable process can be called from a Contact-based record change process, because you can pass the contact’s
account to the invocable process.
3. Before saving your changes, confirm the selection because you can’t change the object after you save it.
Add Process Criteria
Define the criteria that must be true before the process can execute the associated actions.
When criteria are met, the process executes the associated action group. When criteria aren’t met,
the process skips the action group and evaluates the criteria for the next action group.
1. Click Add Criteria.
2. Enter a name for this criteria node.
The name appears on the canvas, so use a name that helps you differentiate between other
criteria nodes.
3. Select the type of criteria that you need to define. This selection determines which fields appear
later in the dialog box.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
If you need...
Select
The record to have certain field values.
Conditions are
met
For example, to execute the associated actions on opportunity records
with an amount greater than $5,000, set the filter to:
[Opportunity].Amount greater than $5000.00
386
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
If you need...
Select
To evaluate the record by using a formula.
Formula evaluates to true
For example, to execute the associated actions on accounts whose annual revenue is over $1,000,000
when the account is changed by someone other than the owner, use this formula.
AND (([Account].LastModifiedBy.Id <> [Account].Owner.Id) ,
([Account].AnnualRevenue > 1000000) )
To simply execute the associated actions without evaluating the record.
No criteria—just execute
The process executes all the actions that are associated with this criteria node and, unless you specify the actions!
otherwise, doesn’t evaluate any remaining criteria nodes in the process. If you choose to stop your
process after executing these actions, we recommend choosing this option for only the last criteria
node in your process.
4. If you selected “Conditions are met”:
a. Define the filter conditions by identifying the field values that the process needs to evaluate.
Field
Select the field whose value you want to evaluate. You can also evaluate values for records that are related to
the one that started the process. To do so, click on a related record with
next to the ID field.
For example, if a contact record started the process, you can evaluate the value for the contact’s account’s
Annual Revenue field. To access that field, click Account Id
, select Annual Revenue, and then
click Choose.
Operator The available operators depend on the field’s data type.
Type
The available value types depend on the field’ data type.
Value
Identify the value that you want to evaluate the field for. See Setting Values in the Process Builder on page 375
for details.
b. For Conditions, identify which conditions must be true for the process to execute the associated actions.
If you choose to use custom logic, enter a text string using:
• Numbers to refer to each condition
• AND or OR to identify whether all or just one of the conditions must true
• Parentheses to group parts of the string together
For example, if you enter 1 AND (2 OR 3), the outcome evaluates to true if the first condition is true and either the second or
third outcome is true. The maximum length of the condition logic text is 1000 characters as per Flow restrictions.
Note: Ambiguous logic separated by a parenthesiss may not cause a validation error. For example:
• 1 AND 2 OR 3 results in an error
• 1 AND (2 AND 3) OR 4 doesn't result in an error
Avoid creating ambiguous custom logic when grouping parts of a string or you may see unexpected results.
387
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
5. If you selected “Formula evaluates to true,” define the formula.
6. Optionally, to specify whether you want to execute the actions only if the record was created or edited to meet criteria, click Advanced
at the bottom of the panel.
For details, see Avoid Unwanted Actions in Processes on page 382.
Note: This setting is available only if the process starts when a record is created or edited and you selected “Filter conditions
are met” or “Formula evaluates to true.”
7. Click Save.
SEE ALSO:
Execute Actions on More Than One Criteria
Add Actions to Your Process
After you define a criteria node, define the actions that are executed when the criteria are met.
Actions are executed in the order in which they appear in the Process Builder.
EDITIONS
An action group can consist of a combination of immediate and scheduled actions. Immediate
actions are executed when evaluation criteria are met. Scheduled actions are executed at a specified
time. For example, Salesforce can automatically send an email reminder to the account team if a
high-value opportunity is still open 10 days before the specified close date.
Available in: both Salesforce
Classic and Lightning
Experience
Before you begin, consider whether you want this action to be executed immediately or at a specific
time. If you want to execute the action at a specific time, identify when those actions should be
executed.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
1. Click Add Action.
2. Select the type of action to create, and then fill out the fields to define the action.
Create a Record from a Process
Create a record by manually entering values or by using the values of related records.
Invoke a Process from Another Process
Invoke a process from another process. With invocable processes, you have the option of reuse
so that you don’t spend your time on repetitive work.
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
Create a Chatter Post from a Process
Post to the feed of a user, a Chatter group, or the record that started the process.
Use a Quick Action from a Process
Create a record, update a record, or log a call by using a quick action that you or another admin created for your organization.
Launch a Flow from a Process
Start an autolaunched flow from your process to automate complex business processes—create flows to perform logic and have
events trigger the flows via processes—without writing code.
Send an Email from a Process
Easily send an email from a process by using an email alert. Email alerts are configured outside of the Process Builder and contain
the standard text, list of recipients, and template for an email.
Submit a Record for Approval from a Process
Submit the record that started the process for approval.
388
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Update Records from a Process
Update one or more records that are related to the record that started the process by manually entering values or by using the values
from related records.
Call Apex Code from a Process
Add customized functionality to your process by calling Apex from the process.
Specify When Your Actions Should Execute with a Schedule
You can schedule actions to execute at a specific time. An action group that supports scheduled
actions can have multiple schedules. For example, you can schedule some actions to execute one
day from now and others to execute three days from now.
Note: Before adding scheduled actions to your process, understand how they work. Review
Scheduled Actions Considerations.
Scheduled actions aren’t supported in all action groups. If you want to schedule actions, make sure
that one of the following options is true for your action group.
• The process starts only when a record is created (1).
• The process starts when a record is created or edited (2), and the associated criteria node
executes actions only when specified changes are made (3).
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
1. In an action group that supports scheduled actions, click Set Schedule.
2. If you need to schedule actions based on a date/time field on the record that started the process:
a. Leave the first radio button selected.
389
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
b. From the dropdown list on the right side of the panel, select the date to schedule the action.
For example, if your process is based on an account record, choose the account’s Created Date.
c. Specify the number of days or hours before or after the field.
If the criteria for this action group are still met when this time occurs, Salesforce executes the scheduled actions.
3. If you need to schedule actions after a certain number of days or hours from when the process is executed:
a. Select the second radio button.
b. Specify the number of days or hours from when the process is executed.
If the criteria for this action group are still met when this time occurs, Salesforce executes the scheduled actions.
4. Save the schedule.
Create a Record from a Process
Create a record by manually entering values or by using the values of related records.
After you create an action and select “Create a Record” for the type, fill in the relevant fields to add
the action to your process. The new record’s Created By field is then set to the user who started
the process by creating or editing a record.
Warning: If you create processes to replace any workflow rules, ensure that you delete those
workflow rules when you activate the equivalent processes. Otherwise, both workflow rules
and processes fire and cause unexpected results, such as overwritten records or redundant
email messages. Do the same if you create processes to replace any Apex triggers.
1. Enter a name for this action.
This text appears on the canvas and helps you differentiate this action from others in your
process. The name truncates to fit on the canvas.
2. For Record Type, select the object that you want to create a record for. To filter the
drop-down list, type the name of the object to filter the drop-down list.
When you select an object, at least one row appears to allow you to set field values for the new
record.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
Warning: Rows appear automatically for fields required by the API. You might need to
provide values for other fields. We recommend that you refer to your organization's page
layouts to determine which fields are required.
3. Set the record’s field values.
Field
Select the field whose value you want to set. To filter the drop-down list, type the name of the field.
Type
Select the type of value that you want to use. The available types depend on the field that you’ve selected.
Value
Set a value for the field. by using the text entry field to manually enter a value or the field picker to use a field value
from a related record. See Setting Values in the Process Builder on page 375 for details.
4. Click Save.
390
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Tip:
• If you set up your process to create an account record, Name appears as a required field. If you want to create a person
account, you can add LastName as a field but it doesn’t appear as required by default. You can enter a dummy value
for the Name field.
• When you create a record, required fields normally appear at the top of the list. However, if you save a Create a Record
action, close the process, and then reopen the action, required fields may not appear in the normal order.
Invoke a Process from Another Process
Invoke a process from another process. With invocable processes, you have the option of reuse so
that you don’t spend your time on repetitive work.
EDITIONS
After you create an action and select “Processes” for the type, fill in the relevant fields to add the
action to your process.
Available in: both Salesforce
Classic and Lightning
Experience
You can invoke processes with objects that share at least one unique ID. For example, in the Account
and Case objects, the AccountId field is unique to Account and also used by Case. You can
create an invocable process that updates a Case record. Then you can invoke it from:
• A process that updates an Account record’s owner
• A process that adds an Account shipping address or updates it
When you create a process that invokes another process, each one counts toward your process
and other applicable limits. DML limits in processes that invoke processes count as one transaction.
Warning: If you create processes to replace any workflow rules, delete those workflow rules
when you activate the equivalent processes. Otherwise, both workflow rules and processes
fire and cause unexpected results, such as overwritten records or redundant email messages.
Do the same if you create processes to replace any Apex triggers.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
1. Enter a name for this action.
This text appears on the canvas and helps you differentiate this action from others in your
process. The name truncates to fit on the canvas.
2. Select an invocable process. You can only select active invocable processes.
3. Select your process variable. Remember that you can only select fields related to the object associated with the process you invoke.
391
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Create a Chatter Post from a Process
Post to the feed of a user, a Chatter group, or the record that started the process.
This action is available only if your organization has Chatter enabled. The feed item will appear as
if the user who started the process—by creating or editing a record—created the post.
Post to a User’s Chatter Feed from a Process
Post to the feed of a user by identifying a specific user in your organization or a User lookup
field on a record.
Post to a Chatter Group from a Process
Post to the feed of a specific Chatter group.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Post to a Record’s Chatter Feed from a Process
Post to the feed of the record that started the process.
USER PERMISSIONS
Mention a User or Group in a “Post to Chatter” Process Action
When you post to a Chatter feed from a process, you can mention users if you can reference
the corresponding User ID field from the field picker.
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
SEE ALSO:
Chatter Settings
Considerations for Processes That Post to Chatter
Post to a User’s Chatter Feed from a Process
Post to the feed of a user by identifying a specific user in your organization or a User lookup field
on a record.
EDITIONS
After you’ve created an action and selected “Post to Chatter” for the action type, fill in the relevant
fields to add the action to your process.
Available in: both Salesforce
Classic and Lightning
Experience
Warning: If the feed that the process tries to post to isn't available when the process is
triggered (for example, because the user is now inactive), the user sees an error and the
process fails.
1. Enter a name for this action.
This text appears on the canvas and helps you differentiate this action from others in your
process. The name truncates to fit on the canvas.
2. In the Post to field, select User.
3. For User, select where you want to find the user.
4. Based on your selection for User, search for or browse for the user whose feed you want to
post to.
When you select a user from a record, you must ultimately select a field that contains a user’s
ID—for example, Owner ID or User ID.
5. Fill out the message that you want to post. You can insert merge fields, add a topic, and mention
users or groups.
The message can contain up to 10,000 characters.
392
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
You can only reference topics that already exist. If you reference a merge field and that field doesn’t have a value, it appears as a
blank value.
6. Save the action.
SEE ALSO:
Chatter Settings
Post to a Chatter Group from a Process
Post to the feed of a specific Chatter group.
EDITIONS
After you’ve created an action and selected “Post to Chatter” for the action type, fill in the relevant
fields to add the action to your process.
Warning: If the feed that the process tries to post to isn't available when the process is
triggered, the user sees an error and the process fails.
1. Enter a name for this action.
This text appears on the canvas and helps you differentiate this action from others in your
process. The name truncates to fit on the canvas.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
2. In the Post to field, select Chatter Group.
3. For Group, search for the Chatter group whose feed you want to post to.
4. Fill out the message that you want to post. You can insert merge fields, add a topic, and mention
users or groups.
The message can contain up to 10,000 characters.
You can only reference topics that already exist. If you reference a merge field and that field
doesn’t have a value, it appears as a blank value.
5. Save the action.
SEE ALSO:
Chatter Settings
393
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Post to a Record’s Chatter Feed from a Process
Post to the feed of the record that started the process.
EDITIONS
You can post to the record’s Chatter feed only if feed tracking is enabled for the object that the
process is associated with.
After you’ve created an action and selected “Post to Chatter” for the action type, fill in the relevant
fields to add the action to your process.
Warning: If the feed that the process tries to post to isn't available when the process is
triggered (for example, because the user is now inactive), the user sees an error and the
process fails.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
1. Enter a name for this action.
This text appears on the canvas and helps you differentiate this action from others in your
process. The name truncates to fit on the canvas.
2. In the Post to field, select This Record.
3. Fill out the message that you want to post. You can insert merge fields, add a topic, and mention
users or groups.
The message can contain up to 10,000 characters.
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
You can only reference topics that already exist. If you reference a merge field and that field
doesn’t have a value, it appears as a blank value.
4. Save the action.
SEE ALSO:
Chatter Settings
Mention a User or Group in a “Post to Chatter” Process Action
When you post to a Chatter feed from a process, you can mention users if you can reference the
corresponding User ID field from the field picker.
EDITIONS
When you’re configuring the Post to Chatter action:
Available in: both Salesforce
Classic and Lightning
Experience
1. In the Message field, enter @[].
2. Place your cursor between the square brackets.
3. Click Merge Field, navigate to the user who you want to mention, select the corresponding
ID field, and click Choose.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
394
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
The field reference appears between the square brackets.
@[{!fieldReference}]
4. Save the action.
Example: To @mention a case’s account owner, navigate to the account’s fields and select Owner ID. Insert that field reference
between the square brackets in @[], so that the result is:
@[{![Case].Account.OwnerId}]
Use a Quick Action from a Process
Create a record, update a record, or log a call by using a quick action that you or another admin
created for your organization.
EDITIONS
Quick actions can be object-specific or global actions. Only Create, Update, and Log a Call actions
are supported. To use a quick action from a process, the action must exist in your organization.
Available in: both Salesforce
Classic and Lightning
Experience
If your organization is using quick actions to help your users more easily create and update records,
you can also use those actions in your process. When you use these quick actions in a process, you
can only set values for fields that are part of the action's layout. If you don’t already have one of
these actions created, see Create Global Quick Actions on page 917 or Create Object-Specific Quick
Actions on page 919 for details.
After you’ve created an action and selected “Quick Actions” for the type, fill in the relevant fields to
add the action to your process. The new or updated record will appear as if the user who started
the process—by creating or editing a record—created or updated it.
1. Enter a name for this action.
This text appears on the canvas and helps you differentiate this action from others in your
process. The name truncates to fit on the canvas.
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
2. Filter to specify the kind of action you want to use.
Filter
Search By
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Lets You Search Through
Global actions All global actions in your organization. You then filter even further by selecting
the Type of actions that you need to search through.
Object
All object-specific actions in your organization that are associated with a
certain Object Name. Global actions can’t be filtered by object.
Type
All object-specific and global actions in your organization based on the type,
such as Create a Record or Log a Call.
• If you selected Global actions or Type, for Type select the specific type of quick action that you want to use.
• If you selected Object, for Object search for and select the object that you want to filter by.
3. For Action, search for and select the action that you want to use.
4. Set field values for the action.
Rows that appear automatically represent the action’s required fields. To set values for the action’s optional fields, add rows.
395
Extend Salesforce with Clicks, Not Code
Field
Lightning Process Builder
Select the field whose value you want to set. To filter the drop-down list, type the name of the field.
You can set values for fields that are included in the action’s layout only.
Type
Select the type of value that you want to use. The available types depend on the field that you’ve selected.
Value
Set a value for the field. by using the text entry field to manually enter a value or the field picker to use a field
value from a related record. See Setting Values in the Process Builder on page 375 for details.
5. Save the action.
Launch a Flow from a Process
Start an autolaunched flow from your process to automate complex business processes—create
flows to perform logic and have events trigger the flows via processes—without writing code.
EDITIONS
In order to launch a flow from a process, you must create and activate the flow. The flow must be
autolaunched. For details, see Create a Flow on page 444.
Available in: both Salesforce
Classic and Lightning
Experience
1. Enter a name for this action.
This text appears on the canvas and helps you differentiate this action from others in your
process. The name truncates to fit on the canvas.
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
2. For Flow, search for and select the flow that you want to launch from this process.
Only active, autolaunched flows are available.
USER PERMISSIONS
3. Optionally, click Add Row to set values for the flow’s variables.
Flow
Variable
Start typing the name of the flow variable whose value you want to set, or
click
to select a flow variable from the drop-down list.
You can set values for any variables in the flow that have Input/Output
Type set to Input Only or Input and Output.
Type
Select the type of value that you want to set. For example, select String to
manually enter the values for a Text collection variable, or select Reference
to use the value of a record for an sObject variable.
Value
Set a value for the flow variable.
• For collection variables, use the text entry field to specify a value. The
value must match the collection variable's data type.
• For sObject variables, use the field picker to select an ID field. The ID
must correspond to a record whose object type matches the sObject
variable’s object type.
• For sObject collection variables, use the field picker to select a related
list. The selected records’ object type must match the sObject collection
variable’s object type. For example, populate an sObject collection
variable with all child contact records associated with the account that
started the process.
396
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Note: If the related list is empty when the flow tries to populate the sObject collection variable
with field values from those records, the process fails.
4. Save the action.
Send an Email from a Process
Easily send an email from a process by using an email alert. Email alerts are configured outside of
the Process Builder and contain the standard text, list of recipients, and template for an email.
EDITIONS
To send an email from a process, you must create the email alert on page 664.
Available in: both Salesforce
Classic and Lightning
Experience
You can use only email alerts that are associated with the same object that the process is associated
with. The record that started the process is used as the starting point for any merge fields that are
used in the email alert.
After you’ve created an action and selected “Email Alerts” for the type, fill in the relevant fields to
add the action to your process.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
1. Enter a name for this action.
This text appears on the canvas and helps you differentiate this action from others in your
process. The name truncates to fit on the canvas.
2. For Email Alert, type two or more letters to search for the email alert that you want to
use to send an email.
USER PERMISSIONS
To create processes:
• View All Data
3. Save the action.
Submit a Record for Approval from a Process
Submit the record that started the process for approval.
EDITIONS
After you’ve created an action and selected “Submit for Approval” for the type, fill in the relevant
fields to add the action to your process.
Only the record that started the process will be submitted. You can’t submit any related records
for approval.
1. Enter a name for this action.
This text appears on the canvas and helps you differentiate this action from others in your
process. The name truncates to fit on the canvas.
2. For Approval Process, indicate whether you need to submit the record through the
default approval process or through a specific approval process.
The process fails if:
• The record is submitted to the default approval process, and there are no active approval
processes for the record’s object type.
• The record is submitted to the default approval process, and it doesn’t meet the criteria for
any of the approval processes for the record’s object type.
• The record is submitted to a specific approval process, and it doesn’t meet the entry criteria.
3. If you need to submit the record to a specific approval process:
397
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
a. Search for and select the approval process.
b. Indicate whether you need to skip the entry criteria for the approval process.
4. For Submitter, identify who should receive notifications about the approval request.
Value
Description
Current User
The user who triggered the process by creating or editing a record.
User Field from a Record
The user ID that’s stored in a field value on the record that’s being submitted for approval or another
record.
Other User
A specific user in your organization.
If the submitter isn’t an allowed initial submitter on the approval process that runs, the process fails. Make sure that the initial
submitters for the approval processes that are related to this object include all users who could trigger this process. For details about
setting the initial submitters for an approval process, see Create an Approval Process with the Standard Wizard on page 612.
5. If necessary, enter submission comments. Don’t reference merge fields or formula expressions.
Submission comments appear in the approval history for the specified record. This text also appears in the initial approval request
email if the template uses the {!ApprovalRequest.Comments} merge field.
6. Save the action.
Update Records from a Process
Update one or more records that are related to the record that started the process by manually
entering values or by using the values from related records.
EDITIONS
After you’ve created an action and selected “Update Records” for the action type, fill in the relevant
fields to add the action to your process. The records’ Last Modified By field is set to the
user who started the process by creating or editing a record.
Available in: both Salesforce
Classic and Lightning
Experience
1. Enter a name for this action.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
This text appears on the canvas and helps you differentiate this action from others in your
process. The name truncates to fit on the canvas.
2. For Record Type, select the record or records that you need to update, and then click
Choose.
You can update only the record that started the process or records that are related to it. For
example, you can reference [Case].ContactId, but not
[Case].Contact.AccountId.
• To update the record that started the process, click the appropriate radio button. For
example, if your process is based on a case record, click next to Select the Case record
that started your process.
398
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
• To update a record that’s related to the record that started the process, click the appropriate radio button and select one of the
field names in the drop-down list.
If you select a field that ends in “ID,” you’re selecting a single record. This field name corresponds to a lookup field on the original
record. For details on lookup fields, see Custom Field Types on page 139.
For example, if a case record started the process and you select Account Id, this action updates the account that’s associated
with the case.
If you select a plural item that doesn’t end in “ID,” you’re updating all the records of that object type that are related to the record
that started the process. This plural item corresponds to child records of the original record, which might appear in a related list
on the original record.
For example, if you select CaseComments, this action updates all the case comments that are related to the case.
399
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
• To update fields on a related record, click on a field with
next to it (ending in “ID”) to access that record’s fields.
For example, let’s say that, for a process that evaluates a case record (1), you want to update all contacts that are related to the
case’s parent account. Click Account ID
(2), then Contacts (3), and then Choose.
3. Optionally, specify conditions to filter the records you’re updating.
For example, if your process updates the status of a parent case, specify conditions so that you won’t update the parent case if its
status is set to On Hold.
Note: When you define conditions for updating records, you can’t:
• Reference a Long Text Area field
• Reference a Rich Text field
• Reference a child record’s related fields
For example, you can reference [Case].ContactId, but not [Case].Contact.AccountId.
When you define multiple filters, the filter logic usually defaults to AND. However, if multiple filters have the same field
selected and use the equals operator, the filters are combined with OR. For example, your filters check whether a case’s
400
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Type equals Problem (1), Type equals Feature Request (2), and Escalated equals true (3). At runtime, those filters are
combined to (1 OR 2) AND 3.
If you’re updating the record that started the process, Process Builder adds an implicit filter for you in the background:
[Object].Id equals myCurrentVariable.Id. If you add filter criteria that set the record’s ID to a value
using the equals operator, at runtime the [Object].Id equals filters are combined using OR filter logic. For
example, you update the case that started the process and add this filter: [Case].Id equals 500D00000044XgV.
At runtime, your filter is combined with the implicit filter ([Case].Id equals myCurrentVariable.Id) with
OR.
a. Select Updated records meet all conditions.
b. Set the conditions that you want to use to filter the updated records.
Field
Select the field whose value you want to evaluate.
Operator The available operators depend on the field’s data type.
Type
The available value types depend on the field’ data type. See Process Builder Value Types on page 377 for details.
Value
Identify the value that you want to evaluate the field for.
For example, if your process updates account records, you can choose to update only accounts with an annual revenue (1)
greater than (2) $1,000,000 (3).
4. Specify the new field values.
Field
Select the field whose value you want to set. To filter the drop-down list, type the name of the field.
You can assign values to fields only on the record or records that you identified in the Object field. Use a separate
Update Records action to update fields on related records.
Type
Select the type of value that you want to use. The available types depend on the field that you’ve selected.
Value
Set a value for the field. For example, if you select a Formula value type, click Build a formula... to create a formula
value for the field.
5. Save the action.
401
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Call Apex Code from a Process
Add customized functionality to your process by calling Apex from the process.
After you’ve created an action and selected “Apex” for the type, fill in the relevant fields to add the
action to your process.
Important: To use this action in a process, ask your developer to annotate the appropriate
method with @InvocableMethod. For details, see “InvocableMethod Annotation”
in the Apex Developer Guide.
The Apex class and the process are executed by the user whose action triggered the process.
1. Enter a name for this action.
This text appears on the canvas and helps you differentiate this action from others in your
process. The name truncates to fit on the canvas.
2. Choose an Apex class by entering the name of the class to filter results or select a class from
the drop-down list.
3. If the class includes an invocable variable, you can manually enter values or reference field
values from a related record.
The value must match the variable’s data type. You can set values for sObject and primitive
type list variables only.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
• To set values for sObject variables and sObject list values, reference an object’s related
records, for example, all child contact records associated with the Account object that started the process.
• To set a value for a primitive list variable (String, Integer, Time, and so on), select the String value type and enter a value in the
text input field. You can’t pass multiple values to lists.
4. Click Save.
Note: If you define an Apex action in your process and then modify the Apex class by adding a standard field reference (for
example, User.Phone), the Apex action is no longer visible in the process and must be added again.
402
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Execute Actions on More Than One Criteria
Choose whether to stop or continue your process after specific criteria are met and associated
actions execute.
EDITIONS
For each criteria and associated action group, you can choose whether to stop the process after
actions execute or continue evaluating the next defined criteria.
Available in: both Salesforce
Classic and Lightning
Experience
1. Make sure you’ve defined the next criteria and that your action group includes only immediate
actions. You can’t evaluate the next criteria when an action group contains scheduled actions.
2. To change what happens after actions execute, click STOP (1) or EVALUATE THE NEXT
CRITERIA (2). Initially, each action group is set to stop after executing actions.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To create, edit, or view
processes:
• Manage Force.com Flow
AND
View All Data
3. Save your changes, and your choice appears on the canvas.
403
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Process Management
The Process Builder allows you to see and manage all your processes in one place.
EDITIONS
To manage a process, from Setup, enter Builder in the Quick Find box, then select Process
Builder.
From the process management page, you can:
• Create a process
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• Edit a process
• Delete an inactive process
• See the status of your existing processes
• Sort your processes by name, description, object, last modified date, or status
When you open a process, you can:
USER PERMISSIONS
• Clone the process
To manage processes:
• Manage Force.com Flow
• Activate or deactivate the process
• Edit the process properties
AND
From the Paused and Waiting Interviews list on the flow management page, you can:
View All Data
• Monitor scheduled actions that haven’t yet been executed
• Delete groups of scheduled actions that you no longer need to wait for
Process Status
Each process has a status that determines whether the process can be edited, activated, or deleted.
Status
Description
Editable?
Active
The process has been activated.
No
You can’t make changes to an active process. However, you can
clone it. Make any necessary changes to the cloned process and
then activate it. Don’t forget to deactivate the original process if
appropriate.
Inactive
The process is inactive and can be activated.
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Yes
404
EDITIONS
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Clone a Process
If you want to make changes to an existing process, save a clone of that process. You can save the
clone as either a new inactive process with its own version history, or as a new inactive version of
the existing process.
To make changes to an active process, you have a few options.
• Deactivate it, make changes, and then reactivate it.
• Clone it as an inactive version, make changes, and then activate the new version. The original
version is automatically deactivated.
• Clone it as a new inactive process, make changes and then activate it. The original process is
not automatically deactivated, so consider whether it’s appropriate for both processes to be
active.
You can create up to 50 versions of a process, but only one version of a given process can be active.
1. From Setup, enter Builder in the Quick Find box, then select Process Builder.
2. Open the process or process version that you want to activate.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To activate or deactivate
processes:
• Manage Force.com Flow
3. Click Clone.
AND
4. You can create a version of the current process or a completely new process with its own version
history.
View All Data
5. Enter a name, API name, and description.
6. Click Save.
Activate a Process
Salesforce doesn’t start using a new or revised process to evaluate records until you activate it.
After you activate a process, you can no longer edit it. However, you can click Clone to save the
process as a new inactive process.
You can’t activate a process unless it has:
• At least one defined criteria node
• At least one defined immediate or scheduled action
1. From Setup, enter Builder in the Quick Find box, then select Process Builder.
2. Open the process version that you want to activate.
3. Click Activate.
If you activate a version of a process that already has an active version, the previously active
version is automatically deactivated. To see that version later, refer to the process’s version
history.
After you’ve activated your process, consider creating or editing test records that will start the
process to make sure it’s working correctly. If you do, remember to delete those test records or
return them to their previous values once you’ve confirmed that your process works as designed.
If you later want Salesforce to stop using a process to evaluate records as they’re created or edited,
open the active process and click Deactivate.
405
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
To activate or deactivate
processes:
• Manage Force.com Flow
AND
View All Data
AND
Customize Application
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Delete a Process Version
If you no longer need to use a process version that you’ve defined, delete it.
To delete an active process, you must first deactivate it. You can’t delete process versions with an
Active status. If another process references your invocable process, you can’t delete the invocable
process. If a process has any scheduled actions, it can’t be deleted until those pending actions have
been executed or deleted.
1. From Setup, enter Builder in the Quick Find box, then select Process Builder.
2. Click the name of the process whose version you want to delete.
3. For the version that you want to delete, click Delete.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
If your process has only one version and you delete that version, the whole process is deleted.
USER PERMISSIONS
4. Click OK.
To delete processes:
• Manage Force.com Flow
AND
View All Data
Monitor Your Processes’ Pending Scheduled Actions
To see which of your processes are still waiting to execute scheduled actions, see the Paused and
Waiting Interviews list on the flow management page.
EDITIONS
1. From Setup, enter Flows in the Quick Find box, then select Flows.
Available in: both Salesforce
Classic and Lightning
Experience
2. Scroll down to the Paused and Waiting Interviews list.
3. Create a view to see scheduled actions in the Paused and Waiting Interviews list. We recommend
displaying the following fields.
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
• Flow Name (1) corresponds to the process’s Process Name.
• Paused Date (2) is the time at which the schedule started for the action group.
To see unexecuted
scheduled actions:
• View Setup and
Configuration
• Current Element (3) identifies the group of scheduled actions that Salesforce is waiting to
execute.
• Type (4) indicates the type of a paused or waiting interview. Processes that are waiting to execute scheduled actions are of type
Workflow.
406
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Current Element displays myWait_myRule_N, where N is the number of the associated criteria and action group. For example, if
Current Element displays myWait_myRule_2, Salesforce is waiting to execute the group of scheduled actions that are associated
with the second criteria in the process.
SEE ALSO:
Delete Unexecuted Scheduled Actions
Delete Unexecuted Scheduled Actions
If you no longer need to wait for a process’s scheduled actions to be executed—for example,
because you need to delete the associated process—you can delete the unexecuted group of
scheduled actions.
1. From Setup, enter Flows in the Quick Find box, then select Flows.
The Waiting Interviews related list displays any unexecuted scheduled actions in your
organization, as well as any waiting flow interviews.
2. For each unexecuted group of scheduled actions that you want to delete, click Del.
You can identify the correct row by the Flow Name field, which corresponds to the process’s
Process Name.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
USER PERMISSIONS
SEE ALSO:
To delete unexecuted
scheduled actions:
• Manage Force.com Flow
Monitor Your Processes’ Pending Scheduled Actions
Troubleshoot Processes
Use the error messages that appear in the Process Builder and the emails you receive when a process
fails to help solve problems that arise when you’re working with processes. When all else fails, look
at the Apex debug logs for your processes.
Common Reasons Why Processes Fail
Here are some common design problems that cause processes to fail.
Errors in the Process Builder
The API names for criteria nodes and actions are created in the background. When you create
or update processes, you might see error messages that reference those names to help you
identify specifically where the problem occurred.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
What Happens When a Process Fails?
When a user performs an action that triggers a process (such as creating a record) and that process fails, the user sees a page with
this error: “Workflow Action Failed to Trigger Flow.” In addition, the administrator who activated the process receives an email with
more details.
407
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Troubleshoot Processes with Apex Debug Logs
Use debug logs to find detailed information about your running processes after they finish running. For example, if a process doesn’t
seem to trigger when a record meets the process’s criteria, or if you want to understand the sequence of processes being executed.
SEE ALSO:
Common Reasons Why Processes Fail
Common Reasons Why Processes Fail
Here are some common design problems that cause processes to fail.
• A user creates or edits a person account. An Account-based process evaluates the record. The
process’s criteria node references an account field, for example, [Account].Name Equals
Acme.
• The process references a field that hasn’t been set. For example, you reference
[Contact].Account.Description in your process. If the Account lookup field isn’t
set on the contact, the process fails because it doesn’t know which account to reference.
The workarounds for this issue depend on where the reference exists in the process.
– If you reference it in filter conditions, add another filter condition that checks whether the
lookup field is set. You can do the same workaround if it’s referenced in a formula, for
example, [Contact].AccountId Is null False.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
– Otherwise, consider making the fields required.
SEE ALSO:
Troubleshoot Processes
Errors in the Process Builder
What Happens When a Process Fails?
Errors in the Process Builder
The API names for criteria nodes and actions are created in the background. When you create or
update processes, you might see error messages that reference those names to help you identify
specifically where the problem occurred.
API Name
Description
myVariable_current.field field is the name of the field that’s referenced.
myVariable_current refers to the field values that
the record had when it started the process.
For example, myVariable_current.Id corresponds
to the record’s field value for Id when the record started
the process.
408
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
API Name
Description
myVariable_old.field
field is the name of the field that’s referenced. myVariable_old refers to
the most recent previous values of the record that started the process.
For example, myVariable_old.Id corresponds to the record’s field value for
Id immediately before the record started the process.
Example:
The element has an invalid reference to “myVariable_current.AnnualRevenue”.
myVariable_current.AnnualRevenue refers to the value for the field AnnualRevenue when the record started
the process.
Note: Error or warning messages might refer to a “flow” instead of a “process.” Those messages still apply to your process.
SEE ALSO:
Common Reasons Why Processes Fail
What Happens When a Process Fails?
When a user performs an action that triggers a process (such as creating a record) and that process
fails, the user sees a page with this error: “Workflow Action Failed to Trigger Flow.” In addition, the
administrator who activated the process receives an email with more details.
The email includes the element that failed, the error message from that failure, and details about
the criteria and actions that the process tried to execute. The subject line is Error Occurred
During Flow “Process_Name”: Error.
Example:
Error Occurred During Flow "Opportunity_Management": No
applicable approval process was found.
// The error occurred when the LeadConvertEmail process was
triggered.
An error occurred at element myRule_1_A1 (FlowActionCall).
No applicable approval process was found.
// The error occurred at the first action (A1) that’s
associated with the
// first criteria node (myRule_1).
Flow Details
Flow Name: Opportunity_Management
Type: Workflow
Version: 3
Status: Active
// The user triggered version 3 of the Opportunity_Management
process.
Flow Interview Details
409
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Interview Label: Opportunity_Management-3_Opportunity
Current User: Madison Rigsby (0051a000000qJXL)
Start time: 2/2/2017 11:21 AM
Duration: 0 seconds
// The process was triggered by user Madison Rigsby.
How the Interview Started
Madison Rigsby (0051a000000qJXL) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = 0061a00000D3ibfAAB
myVariable_current = 0061a00000D3ibfAAB
ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "2/2/2017 11:21 AM"
DECISION: myDecision
Executed this outcome: myRule_1
Outcome conditions: and
1. {!myVariable_current.StageName} (Proposal/Price Quote) Equals Proposal/Price Quote
Logic: All conditions must be true (AND)
// The first criteria node (myRule_1) checks whether the opportunity’s StageName
// is “Proposal/Price Quote”. It is, so the process moves on to execute the associated
// actions.
SUBMIT FOR APPROVAL: myRule_1_A1
Inputs:
objectId = {!myVariable_current.Id} (0061a00000D3ibfAAB)
comment = null
Error Occurred: No applicable approval process was found.
// The process tries to execute the first associated action.
// The action fails because no approval processes exist that
// the record can be submitted to. Maybe the org doesn’t include
// any active Opportunity approval processes. Or maybe it does, but the
// record doesn’t meet the entry criteria for any of them.
SEE ALSO:
Common Reasons Why Processes Fail
410
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Troubleshoot Processes with Apex Debug Logs
Use debug logs to find detailed information about your running processes after they finish running.
For example, if a process doesn’t seem to trigger when a record meets the process’s criteria, or if
you want to understand the sequence of processes being executed.
Tip: Make sure that your filters include FINER events in the WORKFLOW category. For details,
see Debug Log Levels.
When using debug logs to troubleshoot a process, consider the following.
• Processes created in the Process Builder appear as flows and workflow rules in debug logs. The
generated names have some resemblance to the process names, but they don’t map one-to-one.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Professional,
Enterprise, Performance,
Unlimited, and Developer
Editions
• Standard processes appear as flows of type Workflow. Invocable processes appear as flows of
type InvocableProcess.
• Immediate actions that may appear to be executed in a block are strung together in the flow. If one action fails in the middle, then
the following actions might not run.
• Scheduled actions are executed after a Wait element. The actions are executed similarly to immediate actions after the process
resumes.
• WF_CRITERIA_BEGIN and WF_CRITERIA_END refer to the workflow rule criteria that is always set to true and not the
criteria defined in your process.
• Here’s how elements in the Process Builder correspond to flow debug events.
Process Builder
Element
Flow Debug Event
Criteria
FLOW_RULE_...
Create a Record
FLOW_ELEMENT_...
Update Records
FLOW_ELEMENT_...
Post to Chatter
FLOW_ACTIONCALL_...
Submit for Approval
FLOW_ACTIONCALL_...
Email Alerts
FLOW_ACTIONCALL_...
Flows
FLOW_ACTIONCALL_...
Processes
FLOW_ACTIONCALL_...
Apex
FLOW_ACTIONCALL_...
Schedule
FLOW_WAIT_...
Example: Debugging Immediate Actions
This example covers a process with an immediate Apex action.
Here’s what you can tell from this first snippet.
• The process is triggered by a lead with the name “L104”.
• The name of the process is “Apex Say Hello”, which corresponds with the name used in the log
“Apex_Say_Hello301xx000000001Y”. The number appended to the end of the name is the process version’s ID.
411
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
• The process is set to trigger when a record is created or edited (ON_ALL_CHANGES).
17:07:29.086 (86806000)|EXECUTION_STARTED
17:07:29.086 (86928000)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Lead
17:07:29.113 (113974000)|WF_RULE_EVAL_BEGIN|Assignment
17:07:29.114 (114043000)|WF_SPOOL_ACTION_BEGIN|Assignment
17:07:29.114 (114060000)|WF_ACTION|.
17:07:29.114 (114071000)|WF_RULE_EVAL_END
17:07:29.114 (114093000)|WF_RULE_EVAL_BEGIN|Workflow
17:07:29.114 (114178000)|WF_CRITERIA_BEGIN|
[Lead: L104 00Qxx000002S8vh]|Apex_Say_Hello301xx000000001Y|
01Qxx0000002nea|ON_ALL_CHANGES|0
In this section, the process compares the record’s current values to the values it had before it was changed. “myVariable_current”
contains all of the record’s current field values. “myVariable_old” contains all of the field values of the record immediately before
it was changed. “myVariable_old” has no values (null), so the process is evaluating a newly created lead.
17:07:29.114 (114553000)|WF_FORMULA|
Formula:ENCODED:[treatNullAsNull]true|Values:
17:07:29.114 (114571000)|WF_CRITERIA_END|
true
17:07:29.132 (132792000)|WF_SPOOL_ACTION_BEGIN|
Workflow
17:07:29.132 (132881000)|WF_ACTION|
Flow Trigger: 1;
17:07:29.132 (132897000)|WF_RULE_EVAL_END
17:07:29.137 (137127000)|WF_FLOW_ACTION_BEGIN|
09Lxx000000000B
17:07:29.137 (137249000)|WF_FLOW_ACTION_DETAIL|
09Lxx000000000B|[Lead: L104 00Qxx000002S8vh]|Id=09Lxx000000000B|
CurrentRule:Apex_Say_Hello301xx000000001Y (Id=01Qxx0000002nea)
17:07:29.139 (139429000)|FLOW_CREATE_INTERVIEW_BEGIN|
00Dxx0000001gH6|300xx00000002cI|301xx000000001Y
17:07:29.140 (140996000)|FLOW_CREATE_INTERVIEW_END|
108a970cb7aeabf8804183a600514a3bb92516-7f92|Apex Say Hello 2
17:07:29.142 (142898000)|WF_FLOW_ACTION_DETAIL|Param Name: myVariable_current,
Param Value: ENCODED:{![treatNullAsNull]{!ID:this}},
Evaluated Param Value:{
LastModifiedByID=005xx000001SwUpAAK, LastTransferDate=2014-12-12 01:07:29,
ConnectionReceivedDate=null, LastModifiedDate=2014-12-12 01:07:29, LeadSource=null,
LastName=L104, NumberofLocations__c=null, NumberOfEmployees=null,
DandbCompanyId=null,
DoNotCall=false, Primary__c=null, CreatedByID=005xx000001SwUpAAK,
ConnectionSentDate=null,
MobilePhone=null, Jigsaw=null, Salutation=null, HasOptedOutOfEmail=false,
Country=null, LastViewedDate=null, ConvertedOpportunityId=null,
EmailBouncedReason=null,
Email=null, Rating=null, SICCode__c=null, CleanStatus=Pending,
CreatedById=005xx000001SwUpAAK,
IsDeleted=false, Longitude=null, Id=00Qxx000002S8vhEAC, Industry=null, Street=null,
Phone=null, IsConverted=false, EmailBouncedDate=null, HasOptedOutOfFax=false,
OwnerId=005xx000001SwUpAAK, AnnualRevenue=null, CompanyDunsNumber=null,
IsUnreadByOwner=true,
412
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
LastActivityDate=null, SystemModstamp=2014-12-12 01:07:29, ProductInterest__c=null,
Latitude=null, FirstName=null, PhotoUrl=null, Company=LC,
CampaignMemberStatus=null,
Description=null, LastReferencedDate=null, LastModifiedById=005xx000001SwUpAAK,
Website=null, Fax=null, InternalSource=0, City=null, Title=null,
MasterRecordId=null,
CampaignId=null, Status=Open - Not Contacted, JigsawContactId=null,
ConvertedDate=null,
PostalCode=null, State=null, CreatedDate=2014-12-12 01:07:29,
ConvertedContactId=null,
ConvertedAccountId=null, CurrentGenerators__c=null
}|
Param Name: myVariable_old,
Param Value: {!old},
Evaluated Param Value: null
This section shows the start of the process—indicated by “FLOW_START_INTERVIEWS_BEGIN”—and the criteria defined in the
process. “FLOW_RULE_” always corresponds to criteria in the process, and we see that “myRule_1” is evaluated as “true”. The
number in “myRule_1” indicates that the process is executing the group of scheduled actions that are associated with the first
criteria in the process.
17:07:29.143 (143184000)|FLOW_START_INTERVIEWS_BEGIN|1
17:07:29.147 (147213000)|FLOW_START_INTERVIEW_BEGIN|
108a970cb7aeabf8804183a600514a3bb92516-7f92|Apex Say Hello 2
17:07:29.147 (147389000)|FLOW_VALUE_ASSIGNMENT|
108a970cb7aeabf8804183a600514a3bb92516-7f92|myVariable_old|
17:07:29.148 (148138000)|FLOW_VALUE_ASSIGNMENT|
108a970cb7aeabf8804183a600514a3bb92516-7f92|myVariable_current|{
LastModifiedByID=005xx000001SwUpAAK, LastTransferDate=2014-12-12 01:07:29,
ConnectionReceivedDate=null, LastModifiedDate=2014-12-12 01:07:29, LeadSource=null,
LastName=L104, NumberofLocations__c=null, NumberOfEmployees=null,
DandbCompanyId=null,
DoNotCall=false, Primary__c=null, CreatedByID=005xx000001SwUpAAK,
ConnectionSentDate=null,
MobilePhone=null, Jigsaw=null, Salutation=null, HasOptedOutOfEmail=false,
Country=null,
LastViewedDate=null, ConvertedOpportunityId=null, EmailBouncedReason=null,
Email=null,
Rating=null, SICCode__c=null, CleanStatus=Pending, CreatedById=005xx000001SwUpAAK,
IsDeleted=false, Longitude=null, Id=00Qxx000002S8vhEAC, Industry=null, Street=null,
Phone=null, IsConverted=false, EmailBouncedDate=null, HasOptedOutOfFax=false,
OwnerId=005xx000001SwUpAAK, AnnualRevenue=null, CompanyDunsNumber=null,
IsUnreadByOwner=true,
LastActivityDate=null, SystemModstamp=2014-12-12 01:07:29, ProductInterest__c=null,
Latitude=null, FirstName=null, PhotoUrl=null, Company=LC,
CampaignMemberStatus=null,
Description=null, LastReferencedDate=null, LastModifiedById=005xx000001SwUpAAK,
Website=null,
413
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Fax=null, InternalSource=0, City=null, Title=null, MasterRecordId=null,
CampaignId=null,
Status=Open - Not Contacted, JigsawContactId=null, ConvertedDate=null,
PostalCode=null,
State=null, CreatedDate=2014-12-12 01:07:29, ConvertedContactId=null,
ConvertedAccountId=null,
CurrentGenerators__c=null
}
17:07:29.148 (148427000)|FLOW_ELEMENT_BEGIN|
108a970cb7aeabf8804183a600514a3bb92516-7f92|FlowDecision|myDecision
17:07:29.149 (149938000)|FLOW_RULE_DETAIL|
108a970cb7aeabf8804183a600514a3bb92516-7f92|myRule_1|true
17:07:29.149 (149976000)|FLOW_VALUE_ASSIGNMENT|
108a970cb7aeabf8804183a600514a3bb92516-7f92|myRule_1|true
17:07:29.150 (150050000)|FLOW_ELEMENT_END|
108a970cb7aeabf8804183a600514a3bb92516-7f92|FlowDecision|myDecision
In this section, the immediate actions for the first criteria are executed. In the name “myRule_1_A1”, “A1” indicates that this
corresponds to the first action in the action group. We also see the Apex class “SayHello.sayHello” and the details of the Apex class
execution. Then the process finishes with no errors.
17:07:29.150 (150117000)|FLOW_ELEMENT_BEGIN|
108a970cb7aeabf8804183a600514a3bb92516-7f92|FlowActionCall|myRule_1_A1
17:07:29.150 (150146000)|FLOW_ELEMENT_DEFERRED|
FlowActionCall|myRule_1_A1
17:07:29.150 (150194000)|FLOW_ELEMENT_END|
108a970cb7aeabf8804183a600514a3bb92516-7f92|FlowActionCall|myRule_1_A1
17:07:29.150 (150233000)|FLOW_START_INTERVIEW_END|
108a970cb7aeabf8804183a600514a3bb92516-7f92|Apex Say Hello 2
17:07:29.150 (150316000)|FLOW_BULK_ELEMENT_BEGIN|
FlowActionCall|myRule_1_A1
17:07:29.151 (151772000)|CODE_UNIT_STARTED|
[EXTERNAL]|01pxx00000000DN|SayHello.sayHello
17:07:29.153 (153773000)|METHOD_ENTRY|
[1]|01pxx00000000DN|SayHello.SayHello()
17:07:29.153 (153821000)|METHOD_EXIT|
[1]|SayHello
17:07:29.154 (154292000)|SYSTEM_CONSTRUCTOR_ENTRY|
[4]|<init>()
17:07:29.154 (154392000)|SYSTEM_CONSTRUCTOR_EXIT|
[4]|<init>()
17:07:29.154 (154564000)|SYSTEM_METHOD_ENTRY|
[5]|List<String>.add(Object)
17:07:29.154 (154748000)|SYSTEM_METHOD_EXIT|
[5]|List<String>.add(Object)
17:07:29.084 (154888000)|CUMULATIVE_LIMIT_USAGE
17:07:29.084|LIMIT_USAGE_FOR_NS|(default)|
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 50000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 150
Number of DML rows: 0 out of 10000
414
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
Maximum CPU time: 0 out of 10000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
17:07:29.084|CUMULATIVE_LIMIT_USAGE_END
17:07:29.154 (154949000)|CODE_UNIT_FINISHED|
SayHello.sayHello
17:07:29.155 (155090000)|FLOW_ACTIONCALL_DETAIL|
108a970cb7aeabf8804183a600514a3bb92516-7f92|myRule_1_A1|Call Apex|SayHello|true|
17:07:29.155 (155133000)|FLOW_VALUE_ASSIGNMENT|
108a970cb7aeabf8804183a600514a3bb92516-7f92|myRule_1_A1|true
17:07:29.155 (155268000)|FLOW_BULK_ELEMENT_END|
FlowActionCall|myRule_1_A1|0|4
17:07:29.155 (155371000)|FLOW_START_INTERVIEWS_END|
1
17:07:29.159 (159563000)|WF_FLOW_ACTION_END|
09Lxx000000000B
17:07:29.159 (159787000)|WF_ACTIONS_END|
Flow Trigger: 1;
17:07:29.159 (159815000)|CODE_UNIT_FINISHED|
Workflow:Lead
17:07:29.161 (161221000)|EXECUTION_FINISHED
Example: Debugging Scheduled Actions
This example highlights parts of a debug log for a process with a scheduled Post to Chatter action.
A schedule is always indicated by “myWait_”. This section shows the process’s running schedule “myWait_myRule_2”. Any events
that start with “FLOW_WAIT_” also correspond to a schedule in a process.
20:06:28.928 (928266000)|FLOW_ELEMENT_BEGIN|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|WaitInfo|myWait_myRule_2
20:06:28.928 (928302000)|FLOW_ELEMENT_DEFERRED|
WaitInfo|myWait_myRule_2
20:06:28.928 (928361000)|FLOW_ELEMENT_END|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|WaitInfo|myWait_myRule_2
20:06:28.929 (929671000)|FLOW_BULK_ELEMENT_BEGIN|
WaitInfo|myWait_myRule_2
20:06:29.005 (1005229000)|FLOW_WAIT_EVENT_WAITING_DETAIL|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|myWait_myRule_2|
myWaitEvent_myRule_2|alarmDateRef|true
20:06:29.005 (1005317000)|FLOW_VALUE_ASSIGNMENT|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|myWaitEvent_myRule_2|true
20:06:30.225 (2225117000)|FLOW_WAIT_WAITING_DETAIL|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|myWait_myRule_2|1|0Foxx0000000001
20:06:30.225 (2225362000)|FLOW_BULK_ELEMENT_END|
WaitInfo|myWait_myRule_2|0|1296
415
Extend Salesforce with Clicks, Not Code
Lightning Process Builder
...
20:06:30.234 (2234916000)|WF_TIME_TRIGGERS_BEGIN
20:06:30.248 (2248007000)|WF_ACTIONS_END|
Flow Trigger: 1;
20:06:30.248 (2248072000)|CODE_UNIT_FINISHED|
Workflow:Lead
20:06:30.250 (2250129000)|EXECUTION_FINISHED
For scheduled actions, the debug log shows an additional log when the scheduled actions are performed. This is a separate entry
in the debug log, as shown in the following example for this scheduled Post to Chatter action. After the scheduled time occurs,
an automated process executes the scheduled actions. The log uses coordinated universal time (UTC) instead of the user’s time
zone. However, the actions are still executed as the user who originally caused the process to run.
“FLOW_WAIT_EVENT_RESUMING_DETAIL” indicates that the interview is being resumed so that the process can execute its
scheduled actions. “alarmDateRef” indicates that this schedule is based on a field value. We then see that the Post to Chatter action
is executed.
00:14:10.466 (1418357225466561000)|FLOW_BULK_ELEMENT_BEGIN|
WaitInfo|myWait_myRule_2
00:14:10.469 (1418357225469327000)|FLOW_WAIT_EVENT_RESUMING_DETAIL|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|myWait_myRule_2|
myWaitEvent_myRule_2|alarmDateRef
00:14:10.469 (1418357225469412000)|FLOW_WAIT_RESUMING_DETAIL|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|myWait_myRule_2|
0Foxx000000000100:14:10.469 (1418357225469733000)|
FLOW_BULK_ELEMENT_END|WaitInfo|myWait_myRule_2|0|3
00:14:10.469 (1418357225469826000)|FLOW_ELEMENT_BEGIN|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|
FlowDecision|myPostWaitDecision_myRule_2
00:14:10.471 (1418357225471235000)|FLOW_RULE_DETAIL|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|myPostWaitRule_myRule_2|true
00:14:10.471 (1418357225471275000)|FLOW_VALUE_ASSIGNMENT|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|myPostWaitRule_myRule_2|true
00:14:10.471 (1418357225471348000)|FLOW_ELEMENT_END|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|
FlowDecision|myPostWaitDecision_myRule_2
00:14:10.471 (1418357225471441000)|FLOW_ELEMENT_BEGIN|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|
FlowActionCall|myRule_2_SA1
00:14:10.471 (1418357225471486000)|FLOW_ELEMENT_DEFERRED|
FlowActionCall|myRule_2_SA1
00:14:10.471 (1418357225471551000)|FLOW_ELEMENT_END|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|
FlowActionCall|myRule_2_SA1
00:14:10.471 (1418357225471624000)|FLOW_BULK_ELEMENT_BEGIN|
FlowActionCall|myRule_2_SA1
00:14:10.841 (1418357225841584000)|FLOW_ACTIONCALL_DETAIL|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|
myRule_2_SA1|Post to Chatter|chatterPost|true|
00:14:10.841 (1418357225841661000)|FLOW_VALUE_ASSIGNMENT|
345ad8ae889702ab70b5df5712b14a3c990e9d-7ea5|myRule_2_SA1|true
416
Extend Salesforce with Clicks, Not Code
Visual Workflow
00:14:10.841 (1418357225841773000)|FLOW_BULK_ELEMENT_END|
FlowActionCall|myRule_2_SA1|0|370
SEE ALSO:
Troubleshoot Processes
Visual Workflow
Visual Workflow lets you automate business processes by building flows and distributing them to
the right users or systems. A flow is an application that can execute logic, interact with the Salesforce
database, call Apex classes, and collect data from users. You can build flows by using the Cloud
Flow Designer.
Flows can either require user interaction—perhaps a wizard or guided UI for data entry—or run in
the background on their own—perhaps something that automatically transfers records when a
user’s role changes.
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
Limits and Considerations for Visual Workflow
When designing, managing, and running flows, consider the permissions, use limits, and data
issues.
Create a Flow
Once you understand the process that you want to automate, design a flow in the Cloud Flow Designer for that process.
Manage Your Flows
Use the flow detail page to do anything with your flow outside of designing it—such as activating a flow, testing it, or viewing its
properties.
Distribute Your Flow
After you’ve created and activated a flow version, distribute it to users so that they can run it. Which distribution method you use
depends on the users that you want to distribute the flow to: internal users, external users, systems, or other orgs.
Why Did My Flow Interview Fail?
To troubleshoot a failed flow interview, use the flow fault email. You can also set up temporary Screen or Send Email elements to
identify the problem.
Flow Interviews
A flow interview is a running instance of a flow. A flow is an application built by your administrator that asks you for inputs and does
something in Salesforce based on those inputs.
Visual Workflow Terminology
SEE ALSO:
Which Automation Tool Do I Use?
Flow Building Blocks
What's the Difference Between Workflow and Visual Workflow?
Despite their similar names, Workflow and Visual Workflow are separate Salesforce features for automating business processes.
417
Extend Salesforce with Clicks, Not Code
Visual Workflow
Workflow
Workflow enables you to set up workflow rules. A workflow rule identifies what kinds of record changes or additions trigger specified
workflow actions, such as sending email alerts and updating record fields.
Workflow rules and actions are associated with a specific object (and can cross objects only to update fields on a related master
record).
Visual Workflow
Visual Workflow enables you to create flows, which are triggered by users rather than events. Unlike Workflow, which always executes
rules and actions behind the scenes, Visual Workflow offers screens for displaying and collecting information from the user running
the flow.
Note: You can, however, participate in a pilot program that enables workflow rules to execute flows behind the scenes. The
pilot program for flow trigger workflow actions is closed. If you've already enabled the pilot in your org, you can continue to
create and edit flow trigger workflow actions. If you didn't enable the pilot in your org, use the Flows action in Process Builder
instead.
Flows aren’t tied to any one object. They can look up, create, update, and delete records for multiple objects.
In case you’re wondering, the “visual” in Visual Workflow refers to the ability to visually build flows using the Cloud Flow Designer.
Its drag-and-drop user interface lets you build flows without writing any code.
SEE ALSO:
Which Automation Tool Do I Use?
Workflow
Visual Workflow
Limits and Considerations for Visual Workflow
When designing, managing, and running flows, consider the permissions, use limits, and data issues.
Limits for Visual Workflow
When using Visual Workflow, keep flow limits and Apex governor limits in mind.
Flow Best Practices
Before you begin building and distributing flows, understand the best practices.
Considerations for Designing Flows
When you design flows, keep certain guidelines in mind.
Considerations for Managing Flows
When managing flows, consider the administration and activation limits.
Considerations for Running Flows
When you run or test a flow, keep the limits and guidelines in mind.
418
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
Extend Salesforce with Clicks, Not Code
Visual Workflow
Flow Accessibility
Visual Workflow is 508-compliant with a few exceptions.
SEE ALSO:
Cloud Flow Designer
Considerations and Limitations for Flows in Lightning Pages
Considerations for Translating Flows
Limits for Visual Workflow
When using Visual Workflow, keep flow limits and Apex governor limits in mind.
Maximum number of versions per flow
50
Maximum number of executed elements at run time
2,000
Maximum number of active flows and processes per org
500
Maximum number of flows and processes per org
1,000
Maximum number of flow interviews or groups of scheduled actions (from 30,000
processes) that are waiting at one time
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
Maximum number of flow interviews that are resumed or groups of scheduled 1,000
actions that are executed per hour
Maximum number of relative time alarms defined in flow versions or
schedules based on a field value in processes
20,000
Apex Governor Limits that Affect Flows
Salesforce strictly enforces limits to ensure that any runaway flows don’t monopolize shared resources in the multitenant environment.
Per-transaction limits, which Apex enforces, govern flows. If an element causes the transaction to exceed governor limits, the system
rolls back the entire transaction. The transaction rolls back even if the element has a defined fault connector path.
Flows in Transactions
Each flow interview runs in the context of a transaction. A transaction represents a set of operations that are executed as a single
unit. For example, a transaction can execute Apex triggers and escalation rules in addition to a flow interview. If one interview in a
transaction fails, all the interviews in the transaction are rolled back, as well as anything else the transaction did. The transaction
doesn’t retry any of the operations—including the flow interview.
Flow Bulkification in Transactions
Programmers can design their code so that similar actions are performed together in one batch. For example, one operation to
create 50 records rather than 50 separate operations that each create one record. This process is called bulkification, and it helps
your transaction avoid governor limits. If you’re working with flows, you don’t even have to think about bulkification. Flow interviews
bulkify actions for you automatically.
SEE ALSO:
Visual Workflow
Limits and Considerations for Visual Workflow
419
Extend Salesforce with Clicks, Not Code
Visual Workflow
Apex Governor Limits that Affect Flows
Salesforce strictly enforces limits to ensure that any runaway flows don’t monopolize shared resources
in the multitenant environment. Per-transaction limits, which Apex enforces, govern flows. If an
element causes the transaction to exceed governor limits, the system rolls back the entire transaction.
The transaction rolls back even if the element has a defined fault connector path.
1
Description
Per-Transaction Limit
Total number of SOQL queries issued
100
(Record Update, Record Delete, Record Lookup,
and Fast Lookup element executions)
Total number of records retrieved by SOQL
queries
EDITIONS
Available in: both Salesforce
Classic and Lightning
Experience
Available in: Enterprise,
Performance, Unlimited,
and Developer Editions
50,000
(across all Record Update, Record Delete, Record
Lookup, and Fast Lookup elements executed in
all interviews in the transaction)
Total number of DML statements issued
150
(Record Create, Record Update, Record Delete,
Fast Create, Fast Update, and Fast Delete
executions)
Total number of records processed as a result
of DML statements
10,000
1
Autolaunched flows are part of the larger transaction through which they were launched. For example, flows launched from a process
are executed with the process actions as part of the larger transaction. Flows with Screen elements can span multiple transactions. A
new transaction begins each time the user clicks Next in a screen. Flows with Wait elements span multiple transactions. A transaction
ends when a flow interview begins to wait for an event. When the flow interview resumes, a new transaction begins. Everything after
the Wait element is executed as part of a batch transaction that includes other resumed interviews.
SEE ALSO:
Apex Developer Guide: Execution Governors and Limits
Limits for Visual Workflow
Flows in Transactions
Each flow interview runs in the context of a transaction. A transaction represents a set of operations that are executed as a single unit.
For example, a transaction can execute Apex triggers and escalation rules in addition to a flow interview. If one interview in a transaction
fails, all the interviews in the transaction are rolled back, as well as anything else the transaction did. The transaction doesn’t retry any
of the operations—including the flow interview.
In each transaction, Salesforce enforces governor limits to prevent shared resources from being depleted. Because multiple Salesforce
organizations share the same resources, Salesforce prevents one organization from depleting all the resources and leaving the other
organizations high and dry. It’s similar to an apartment building that uses one cache of water to service every tenant. If your neighbor
420
Extend Salesforce with Clicks, Not Code
Visual Workflow
uses all the water, you can’t take a shower. (It’s trite, but hopefully you get the idea.) Per-transaction governor limits help prevent such
things from happening.
When Does a Flow’s Transaction Start?
Depending on how the flow was distributed, a transaction that runs an interview for that flow starts in different ways.
When Does a Flow’s Transaction End?
When a transaction ends depends on whether the flow contains certain elements and whether it originally started because a record
was changed.
SEE ALSO:
Flow Bulkification in Transactions
When Does a Flow’s Transaction Start?
Depending on how the flow was distributed, a transaction that runs an interview for that flow starts in different ways.
Distribution Method
Transaction starts when...
Process Builder1
A record is created or updated.
Flow URL
The URL is accessed.
Custom button or link
The button or link is clicked.
Visualforce page
The page is accessed.
Interview.start() method
If the method starts via a before or after trigger, the
transaction starts when a record is created or updated.
Otherwise, the transaction starts when the method (or a parent
method) is invoked.
The start() method shares its limits with other operations in
the transaction and other methods in the class.
REST API (Custom Actions or Flows resource)
When the REST call is made. Depending on how the REST call is
implemented, the limits can be shared with other operations.
1
The same also applies if the flow is distributed through a workflow rule. The pilot program for flow trigger workflow actions is closed.
If you've already enabled the pilot in your org, you can continue to create and edit flow trigger workflow actions. If you didn't enable
the pilot in your org, use the Flows action in Process Builder instead.
Note: When a Screen or Wait element is executed, the existing transaction ends and a new one begins.
When Does a Flow’s Transaction End?
When a transaction ends depends on whether the flow contains certain elements and whether it originally started because a record
was changed.
The transaction ends when:
• A Screen or Wait element is executed
421
Extend Salesforce with Clicks, Not Code
Visual Workflow
• The order of execution has completed—if the flow was triggered when a record was created or updated
• All the interviews in the transaction have finished
Tip: If you think that a flow’s interview is likely to hit governor limits within its transaction, consider adding a Wait element or a
Screen element.
If the interview is one of many things being done in a given transaction, that interview shares the transaction’s governor limits with the
other operations.
Example: You update 100 cases through Data Loader. Due to the order of execution in a transaction and the customizations in
your organization, here’s what happens.
Transaction Operation
DML Statement
Used
1
Cases are saved to the database, but aren’t committed yet.
2
Case assignment rules are executed. Each case’s owner is updated.
3
Case escalation rules are executed. If any case has been open for 10 days, an
email is sent to the owner.
4
Process is started.
5
Process looks up the case’s account.
6
If the account is hot, process uses Chatter to notify the account owner that there’s
a new case associated with the account.
7
Process launches a flow interview.
8
Flow interview looks up the parent account and how many cases it has.
9
Flow interview checks whether the account has more than five open cases.
10
If it does, flow interview looks up the account’s division manager then posts on
the account’s Chatter feed to notify the division manager and account owner.
11
If it doesn’t, flow interview posts on the account’s Chatter feed to notify only the
account owner.
SOQL Query
Used
SEE ALSO:
Apex Developer Guide: Triggers and Order of Execution
Flow Bulkification in Transactions
Programmers can design their code so that similar actions are performed together in one batch. For example, one operation to create
50 records rather than 50 separate operations that each create one record. This process is called bulkification, and it helps your transaction
avoid governor limits. If you’re working with flows, you don’t even have to think about bulkification. Flow interviews bulkify actions for
you automatically.
422
Extend Salesforce with Clicks, Not Code
Visual Workflow
How Does Flow Bulkification Work?
Interview operations are bulkified only when they execute the same element. That means that the interviews must all be associated
with the same flow.
Which