Process Automation, Data Model Flashcards

1
Q

Mitigate SOQL Injection
Salesforce Object Query Language Versus Structured Query Language

SOQL

A

As a Salesforce developer, you know that on the Lightning Platform we use SOQL not SQL. While the languages are similar in many respects, SOQL is essentially a customized version of SQL developed specifically for the Salesforce platform.

Let’s dig into the ways that SOQL differs from SQL. For starters, SOQL is a language exclusively for querying the database rather than modifying data like in traditional SQL. Here is a list of what SOQL does not have.

INSERT, UPDATE, or DELETE statements. It only has SELECT statements.
Command execution.
JOIN statement; however, you can include information from parent objects like Select Name, Phone, and Account.Name from Contact.
UNION operator.
Ability to chain queries together.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Mitigate SOQL Injection
SOQL Injection Prevention

SOQL

A

You can use several techniques to prevent SOQL injection:
Static queries with bind variables
String.escapeSingleQuotes()
Type casting
Replacing characters
Allowlisting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

SOQL Injection Prevention
Static Query and Bind Variables

SOQL

A

The first and most recommended method to prevent SOQL injection is to use static queries with bind variables. Consider the following query.

String query = ‘select id from contact where firstname =\’’+var+’\’’;
queryResult = Database.execute(query);

As you’ve learned, using user input (the var variable) directly in a SOQL query opens the application up to SOQL injection. To mitigate the risk, translate the query into a static query like this:
queryResult = [select id from contact where firstname =:var]
This step ensures that the user input is treated as a variable, not as an executable element of the query. If a user types a value like test’ LIMIT 1 when the database performs the query, it looks for any first names that are “test’ LIMIT 1” in the database. With a bind variable, the attacker can’t break out and control the SOQL query.
While using bind variables is recommended, there are some limitations. They can only be used in the following types of clauses.
The search string in FIND clauses.
The filter literals in WHERE clauses.
The value of the IN or NOT IN operator in WHERE clauses, enabling filtering on a dynamic set of values. (Note that this is of particular use with a list of IDs or strings, though it works with lists of any type.)
The division names in WITH DIVISION clauses.
The numeric value in LIMIT clauses.
The numeric value in OFFSET clauses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

SOQL Injection Prevention
Typecasting

SOQL

A

Another strategy to prevent SOQL injection is to use typecasting. By casting all variables as strings, user input can drift outside of expectation. By typecasting variables as integers or Booleans, when applicable, erroneous user input is not permitted. The variable can then be transformed back to a string for insertion into the query using string.valueOf() (remember with dynamic queries, the database.query() method accepts only a string).
If we enter a simple SOQL injection payload “1 limit 1” and search, the query returns only one result, because our input is treated as code.
The Apex code would look like this:
public String textualAge {get; set;}
[…]
whereClause+=’Agec >’+textualAge+’’;
whereclauserecords = database.query(query+’ where ‘+whereClause);

You can see that variable textualAge is placed directly into the query, allowing our input to be treated as code. You can also see no single quotes aroundtextualAge in the query.
If you apply the same SOQL injection payload of “1 limit 1” to your search, you see that the SOQL injection still functions.
You need another solution to prevent SOQL injection.

You would want to edit the controller again and remove string.escapeSingleQuotes(). Then you’d want to find the variable declaration for textualAge and change it from String to Integer (age is an integer, so this typecasting is appropriate). Because the query is expecting a string but textualAge is now an integer, you need to wrap textualAge in string.valueOf() as follows:
whereClause+=’Agec >’+string.valueOf(textualAge)+’’;

If you submitted your SOQL injection payload “1 limit 1” in the search area again, you would see an error rather than a SOQL injection. “1 limit 1” is not considered an integer, so the SOQL injection is prevented.

Typecasting can be used to prevent many kinds of SOQL injection where the user is not entering text.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

SOQL Injection Prevention
Escaping Single Quotes

SOQL

A

Another cross-site scripting (XSS) mitigation option that is commonly used by developers who include user-controlled strings in their queries is the platform-provided escape function string.escapeSingleQuotes().

This function escapes any instance that it finds of a single quote mark (‘) in the string using the backslash () escape character. This prevents an attacker’s input from being treated as code by constraining them to the boundary of the string.
The Apex code for this would look like the following:

String query = ‘SELECT Id, Name, Title_c FROM Books’;
String whereClause = ‘Title_c like '%’+textualTitle+’%' ‘;
List<Bookswhereclauserecords = database.query(query+’ where ‘+whereClause);
**
The search string “textualTitle” is placed directly into the query string, allowing user input to be treated as code and enabling this SOQL injection. Because the variable is wrapped in single quotes in the final query, we can fix this SOQL injection through string.escapeSingleQuotes().

In the example above, replacing the where clause with the following code wrapping textualTitle with String.escapeSingleQuotes() will prevent an attacker from using SOQL injection to modify the query behavior.

String whereClause = ‘Title_c like '%’+String.escapeSingleQuotes(textualTitle)+’%' ‘;
This time we’re using string.escapesinglequotes() to make sure the user-provided single quote is escaped to appear as data rather than as a query control character. Thus, the application is no longer vulnerable.

However, it is important to point out that this solution applies only to strings. Not all variables are strings, and not all SOQL injection attacks require using a single quote character. Other solutions are required to prevent SOQL injections in these types of code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

SOQL Injection Prevention
Replacing Characters

SOQL

A

A final tool in your tool belt is character replacement, also known as blocklisting. This approach removes “bad characters” from user input.

In security, blocklisting will never be as strong as allowlisting, because it is far easier to predict a few good inputs than to predict all possible bad inputs. That said, blocklisting through character replacement can often effectively mitigate simple problems. Take the following code:

String query = ‘select id from user where isActive=’+var;
While typecasting or allowlisting would be effective here, removing all spaces from the supplied input would be an equally effective approach. In that way, a SOQL injection payload of:

true AND ReceivesAdminInfoEmails=true
becomes
trueANDRecievesAdminInfoEmails=true

The code to remove all spaces from a string can be written as follows:

String query = ‘select id from user where isActive=’+var.replaceAll(‘[^\w]’,’’);
While it should not be considered the first line of defense, development is about flexible solutions to varied problems, and this solution is a valid one to keep in mind.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

SOQL Injection Prevention
Allowlisting

SOQL

A

The previous solution of typecasting was effective only against non-string input. What if user-controlled values need to be text but don’t have any single quotes? This often occurs when other query portions are put under a user’s control, like the Select fields or the From object.

Another way to prevent SOQL injection without string.escapeSingleQuotes() is allowlisting. Create a list of all “known good” values that the user is allowed to supply. If the user enters anything else, you reject the response.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Mitigate Cross-Site Request Forgery
What Is CSRF?

A

This example is precisely what a CSRF attack can look like. The attacker got the user’s client (the browser) to perform an unwanted action (the advancement of a student to the honor roll) on a trusted site (School District Management app) for which the user is currently authenticated.
Let’s start with the idea that we have built an application that lists all of the current students in our network of schools. In this application, there are two important things to note.
Only the admin or the superintendent can access the page allowing users to promote students to the honor roll.
The page automatically refreshes if you click the Honor Roll link. If you’ve added a student, an alert will be noted that your student has been added to the honor roll.
What is happening behind the scenes is that the Honor Roll button makes a GET request to /promote?UserId=<userid>. As the page loads, it reads the URL parameter value and automatically changes the role of that student to the honor roll.</userid>

Seems pretty straightforward. You may be wondering, where’s the vulnerability?
Let’s take a look at this scenario again and change it slightly.
This time, imagine that after logging in to your School District Management org, you decided to browse another website. While on this website, you click a hyperlink. This hyperlink redirects to a link to www.beststudents.com/promote?user_id=123. This malicious link is executed on behalf of the admin (your signed-in account), thereby promoting a student to the honor roll without you realizing it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Mitigate Cross-Site Request Forgery
Prevent CSRF Attacks

A

Consider a slightly different version of the page that has two required URL parameters: userId and token. What if you made the token parameter value a random, unique value that changed on every request? This would make it next to impossible for an attacker to guess the current value, preventing the attack. This example is the most common prevention technique for CSRF.
For this prevention technique to be successful, four things must happen.
All sensitive state-changing requests (anything performing database operations) must include a token.
A token must be unique to the request or user’s session.
A token must be difficult to predict (long with advanced encryption).
The server must validate a token to ensure the request originated from the intended user.
Suppose all four steps are properly implemented by the server. In that case, the attacker can’t guess the current value of the token parameter and can’t manipulate the user’s browser into making the correct honor roll request to the app. The attacker sees an error and is unsuccessful.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Mitigate Cross-Site Request Forgery
Use the Salesforce Platform to Protect Against CSRF

A

Luckily, Salesforce includes out-of-the-box protections against CSRF for developers.

By default, requests made against Salesforce resources have CSRF tokens attached. These pseudo-random tokens prevent the reuse and distribution of hyperlinks to protect privileged accounts from accidentally making state-changing requests that were not intended.

Beyond this, developers of Lightning applications need to pay attention to how their code is structured to prevent CSRF attacks from occurring. The most simple forms of CSRF attacks use HTTP GET requests with state-changing parameters, like GET mywebsite.com?change_username=”joe”.

By simply avoiding the use of state-changing HTTP GET requests, you can eliminate a large number of CSRF vulnerabilities in your code. When you reach out to a web API, use POST or PUT instead when state changes are needed.

Several other mitigations can be put in place in your application to prevent CSRF attacks.

When an endpoint is hit in your API, you can validate the origin header. The origin header is set on HTTP GET requests and specifies the URL from which a request originated. Suppose the request is on the forbidden headers list, meaning all major browsers will not allow it to be spoofed via JavaScript. In that case, it will always return the correct value unless the request initiates from a nonstandard browser or tool.

When you integrate your Salesforce Lightning application with a third-party application via API, you may desire your own anti-CSRF tokens. These can easily be added to XMLHttpRequest within Lightning by using setRequestHeader() in an HTTP request that looks like this:
var o = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function(){
var res = o.apply(this, arguments);
var err = new Error();
this.setRequestHeader(‘anti-csrf-token’, csrftoken);
return res;
};

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Mitigate Cross-Site Request Forgery
CSRF on Lightning Page Load Events

A

Another place for CSRF vulnerabilities is when server-side DML operations are executed automatically as part of a page-loading event such as onInit or afterRender. To mitigate the risk of a page load CSRF, ensure that DML operations are only performed as a result of an interaction with a page (clicking a button, selecting an option, or other actions).
({
doInit: function(cmp) {
var action = cmp.get(“c.updateField”); //vulnerable to CSRF
[…]
$A.enqueueAction(action);
},
handleClick: function(cmp, event) {
var action = cmp.get(“c.updateField”); //not vulnerable to CSRF
[…]
$A.enqueueAction(action);
}
})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Mitigate Server Side Request Forgery
What Is Server Side Request Forgery?

A

Server-side request forgery (SSRF) is a security vulnerability in web applications where an attacker can make unauthorized requests, both internal and external, on behalf of the server. In an SSRF attack, the malicious application tricks the server into making requests to internal and external services or systems, potentially leading to unauthorized access or data exposure.

To illustrate this vulnerability, let’s consider our School District Management developer org. Imagine we have an application that fetches information about students from an internal service that is hosted on a non-routable address. The application is designed to make a GET request to the server whose address is contained in the API request to retrieve the student’s details, for example studentApi=https://192.168.0.1/student.

Now, suppose an attacker observes that the requests sent from the client contain a path value that may be exploitable. Cloud services often expose a REST interface on a metadata endpoint (such as http://169.254.169.254). In addition, some NoSQL databases may be configured to expose unauthenticated REST interfaces on internal interfaces. An attacker would intercept the API call from the client, replace the endpoint value of the student service with a call to the metadata service and exfiltrate sensitive service configuration data from the internal metadata endpoint.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Mitigate Server Side Request Forgery
Preventing SSRF Attacks

A

Preventing SSRF attacks involves implementing measures to validate and restrict the scope of requests. Effective prevention techniques include a combination of the following.

Validate and Sanitize Inputs
Ensure that input values, such as the studentApi value in our example, are properly validated and sanitized to prevent the injection of malicious URLs.
Implement Allowlisting
Restrict the allowed destinations for outgoing requests by enforcing the URL schema, port, and destination allowlist, disabling HTTP redirections. Only allow requests to specified, trusted endpoints.
Use URL Parsing Libraries
Utilize URL parsing libraries to parse and validate URLs before making requests. This helps ensure that the requested URLs conform to expected patterns.
Network Segmentation
Implement network segmentation to restrict the server’s ability to make requests to internal resources, limiting the impact of any potential SSRF attacks.

Salesforce Platform Protections Against SSRF
Salesforce provides built-in protections against SSRF for developers. Requests made against Salesforce resources include safeguards to prevent the exploitation of SSRF vulnerabilities. Additionally, Lightning application developers can use the following best practices to minimize the risk of SSRF.
Avoid GET Requests
Similar to CSRF prevention, developers should avoid using HTTP GET requests. Instead, prefer using POST or PUT requests to minimize risk of SSRF data exfiltration.
Validate Origin Headers
When integrating Salesforce Lightning applications with third-party APIs, validate the origin header in HTTP requests. Ensure that the request originates from a trusted source to prevent potential SSRF exploits.
Implement Anti-SSRF Tokens
Developers can add custom anti-SSRF tokens to XMLHttpRequests within Lightning by using setRequestHeader(). This adds an additional layer of protection against SSRF attacks.
SSRF on Lightning Page Load Events
Another area prone to SSRF vulnerabilities is during server-side Data Manipulation Language (DML) operations triggered by page-loading events like onInit or afterRender. To mitigate the risk, ensure that DML operations are only initiated in response to user interactions, such as clicking a button or selecting an option.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Triggers and Order of Execution
When you save a record with an insert, update, or upsert statement, Salesforce performs a sequence of events in a certain order.

Before Salesforce executes these events on the server, the browser runs JavaScript validation if the record contains any dependent picklist fields. The validation limits each dependent picklist field to its available values. No other validation occurs on the client side.

A

Executes validation checks
Record-triggered flows that are configured to run before the record is saved
Executes all before triggers
system validation steps again
Executes duplicate rules
Saves the record to the database, but doesn’t commit yet
Executes all after triggers.
Executes assignment rules.
Executes auto-response rules.
Executes workflow rules.
Executes escalation rules.
Executes these Salesforce Flow automations - Processes built with Process Builder,
Flows launched by workflow rules (flow trigger workflow actions pilot)
Executes record-triggered flows that are configured to run after the record is saved
Executes entitlement rules.
If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure.
If the parent record is updated, and a grandparent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the grandparent record. Grandparent record goes through save procedure.
Executes Criteria Based Sharing evaluation.
Commits all DML operations to the database.
After the changes are committed to the database, executes post-commit logic. Examples of post-commit logic (in no particular order) include:
Sending email
Enqueued asynchronous Apex jobs, including queueable jobs and future methods
Asynchronous paths in record-triggered flows

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Triggers and Order of Execution

A

When you save a record with an insert, update, or upsert statement, Salesforce performs a sequence of events in a certain order.

Before Salesforce executes these events on the server, the browser runs JavaScript validation if the record contains any dependent picklist fields. The validation limits each dependent picklist field to its available values. No other validation occurs on the client side.

  1. Loads the original record from the database or initializes the record for an upsert statement.
  2. Loads the new record field values from the request and overwrites the old values.
    Salesforce performs different validation checks depending on the type of request.

For requests from a standard UI edit page, Salesforce runs these system validation checks on the record:
Compliance with layout-specific rules
Required values at the layout level and field-definition level
Valid field formats
Maximum field length
Additionally, if the request is from a User object on a standard UI edit page, Salesforce runs custom validation rules.

For requests from multiline item creation such as quote line items and opportunity line items, Salesforce runs custom validation rules.
For requests from other sources such as an Apex application or a SOAP API call, Salesforce validates only the foreign keys and restricted picklists. Before executing a trigger, Salesforce verifies that any custom foreign keys don’t refer to the object itself.
3. Executes record-triggered flows that are configured to run before the record is saved.
4. Executes all before triggers.
5. Runs most system validation steps again, such as verifying that all required fields have a non-null value, and runs any custom validation rules. The only system validation that Salesforce doesn’t run a second time (when the request comes from a standard UI edit page) is the enforcement of layout-specific rules.
6. Executes duplicate rules. If the duplicate rule identifies the record as a duplicate and uses the block action, the record isn’t saved and no further steps, such as after triggers and workflow rules, are taken.
7. Saves the record to the database, but doesn’t commit yet.
8. Executes all after triggers.
9. Executes assignment rules.
10. Executes auto-response rules.
11. Executes workflow rules. If there are workflow field updates:
Updates the record again.
Runs system validations again. Custom validation rules, flows, duplicate rules, processes built with Process Builder, and escalation rules aren’t run again.
Executes before update triggers and after update triggers, regardless of the record operation (insert or update), one more time (and only one more time)
12. Executes escalation rules.
13. Executes these Salesforce Flow automations, but not in a guaranteed order.
Processes built with Process Builder
Flows launched by workflow rules (flow trigger workflow actions pilot)
When a process or flow executes a DML operation, the affected record goes through the save procedure.
14. Executes record-triggered flows that are configured to run after the record is saved
15. Executes entitlement rules.
16. If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure.
17. If the parent record is updated, and a grandparent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the grandparent record. Grandparent record goes through save procedure.
18. Executes Criteria Based Sharing evaluation.
19. Commits all DML operations to the database.
20. After the changes are committed to the database, executes post-commit logic. Examples of post-commit logic (in no particular order) include:
Sending email
Enqueued asynchronous Apex jobs, including queueable jobs and future methods
Asynchronous paths in record-triggered flows

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Order of execution: Additional Considerations

A

Note these considerations when working with triggers.

  1. If a workflow rule field update is triggered by a record update, Trigger.old doesn’t hold the newly updated field by the workflow after the update. Instead, Trigger.old holds the object before the initial record update was made. For example, an existing record has a number field with an initial value of 1. A user updates this field to 10, and a workflow rule field update fires and increments it to 11. In the update trigger that fires after the workflow field update, the field value of the object obtained from Trigger.old is the original value of 1, and not 10.
  2. If a DML call is made with partial success allowed, triggers are fired during the first attempt and are fired again during subsequent attempts. Because these trigger invocations are part of the same transaction, static class variables that are accessed by the trigger aren’t reset.
  3. If more than one trigger is defined on an object for the same event, the order of trigger execution isn’t guaranteed. For example, if you have two before insert triggers for Case and a new Case record is inserted. The firing order of these two triggers isn’t guaranteed.
  4. In API version 53.0 and earlier, after-save record-triggered flows run after entitlements are executed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Workflow Rules

A

Starting in Winter ’23, you can’t create new workflow rules. You can still activate, deactivate, and edit any existing workflow rules. To migrate existing workflow rules, use the Migrate to Flow tool. For new automations, create flows in Flow Builder.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Move Processes and Workflows to Flow Builder with the Migrate to Flow Tool

A

Use the Migrate to Flow tool to convert your Process Builder processes and workflow rules into Flow Builder, including scheduled actions. The tool also supports partial migration of processes for most actions.
Before moving your new flows to production, start with migrating and testing in a sandbox environment.

From Setup, in the Quick Find box, enter Migrate to Flow, and then select Migrate to Flow.
1. Select the process that you want to convert to a flow.
2. Click Migrate to Flow.
3. Select the criteria that you want to migrate.
If it’s a process, the Migratable column indicates whether you can fully or partially migrate the process.
4. Click Migrate to Flow.
If this is a partial migration of a process, click Needs Review when the migration is complete to see the list of actions that require additional configuration.
After you migrate a process or workflow rule, test the flow in Flow Builder.
If everything works as expected, activate the flow.
Deactivate the process or workflow rule you migrated to Flow Builder.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Planning Your Switch to Flow Builder
Migrate to Flow Tool Considerations

A

Workflow Rules and Process Builder are no longer the preferred tools for automating your business processes. With their pending retirement, now is the time to go with Flow Builder as the future of automated processes. Flow Builder is a foundation for the future and offers built-in extensibility, application lifecycle management, and faster performance.

Replace Time-Dependent Workflow Rules with Scheduled Paths
Add a Scheduled Path to a record-triggered flow. Scheduled Paths occur in the future, after the trigger has fired, based on dates and times. You can schedule such actions as reminders or follow-ups based on dates in the record that triggered the automation, such as Close Date. This feature also rechecks the entry conditions.
Example: Set your entry condition to Status = Escalated and then have an automation that sends a reminder two days before close. The reminder only sends if the status remains escalated.

Considerations
1. Processes with recursion aren’t fully supported. When a process with recursion is migrated, the record is evaluated only one time. Test and make sure that any processes with recursion work as intended after migration.

  1. Processes are migrated as Actions and Related Record-optimized (after-save) flows. If necessary, you can edit and optimize the flow for Fast Field Updates (before-save) after the flow is migrated.
  2. The invoke flow action is migrated as a subflow element instead of an invocable flow action. Subflows run in the same transaction as the parent flow. Any processes with invoke flow actions involving external callouts, external actions, or pauses must be redesigned using an asynchronous path.
  3. You can migrate scheduled actions only if you select the single criteria associated with the scheduled action. If multiple criteria are selected, no scheduled actions are migrated. After migration, scheduled actions become scheduled paths in a flow. In the flow, migrated scheduled actions follow the naming convention ScheduledPath_#. At run time, the new flow checks for pending actions from the original migrated process and then deletes them.
  4. You can’t migrate a cross-object reference in a formula.

You can migrate a process that uses a custom metadata reference in a formula. After the migration, the custom metadata reference is used in flow formulas, but you can’t configure it by using the resource picker.

  1. When migrating a time-based process, you must migrate each outcome to its own scheduled action flow. Then activate the new flows and deactivate the process.
  2. Supported Processes
    The Migrate to Flow tool supports only record-triggered processes. Custom event and custom invocable type processes aren’t supported. The tool also doesn’t support processes that contain custom metadata types or criteria that contain a field that’s from a related object (field traversals). For supported processes, you can migrate these action types without additional configuration.
    Record update
    Record create
    Invoke flow
    Invoke Apex
    Email alert
    After migration, these action types retain their original positions in the flow, but they require additional configuration to function as expected.
    Post to Chatter
    Quick Action
    Submit for Approval
    Send Custom Notification
    Live Message Notification
    Send Surveys
    Quip-related action types
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Considerations for Migrating a Workflow to a Flow

A

If a workflow rule contains only field updates, the tool converts it into a fast field update (before-save) flow.

Due to their position in the order of execution, record-triggered flows can behave differently from similar workflow rules.

An at-rest pending time-based action is migrated to a scheduled path when the associated record is changed.

Supported Workflow Rules
The Migrate to Flow tool supports workflow rules that contain these items.
Field-based criteria
Field updates
Email alerts
Outbound messages
Time-dependent workflow actions
Rule criteria formulas that are set to true (unless the evaluation criteria are also set to created, and anytime it’s edited to subsequently meet the criteria)
Equal to null
Not equal to null
Rule criteria formulas
Workflow rules that contain the following can’t migrate with the Migrate to Flow tool.

Criteria with no defined workflow actions
Global variable fields
Fields on related records
Record types
The does not contain, includes, excludes, or within operators
The greater than, greater or equal, less than, less or equal operators on picklist fields
Formulas that use Hour, Minute, Second, TimeNow, TimeValue, IsClone, or $RecordType
Tasks
Relative date values in date fields
Multiple currencies

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Choose Which Salesforce Flow Feature to Use

A

Use Flow Builder to automate most of your organization’s repetitive business processes. More features can provide further automation functionality, including approval processes, Flow Orchestration, Einstein Next Best Action, and Apex.

To determine your automation needs and which feature to use, ask these questions.

When do you want the automation to start running?
What do you want to happen after the automation starts?

For example, when you add a contact, you want the contact to receive a welcome email.
Start: When a contact is created.
Automation: Send an email to the contact.

What Can Start or Trigger a Flow?

FLOW STARTS OR TRIGGERS FLOW TYPE TO USE FOR EXAMPLE, YOU WANT SOMETHING TO HAPPEN…
When a record is created Record-Triggered When a new case is created.
When a record is updated Record-Triggered When a lead’s status field is changed.
When a record is created or updated **Record-Triggered When an account is created or the account priority field is changed.
When a record is deleted Record-Triggered When a contact is deleted.
After a certain amount of time Record-Triggered A week after a quote is created. Add a scheduled path to the record-triggered flow.
At a specified time and frequency Schedule-Triggered Every Saturday at midnight.
When a user clicks a button on a form Screen - When a customer enters contact information into a flow screen and clicks the Next button.
When a user clicks a quick action button Screen When an employee clicks Request PTO on their employee record. Opens a form to complete.
When a user clicks a custom button or link Autolaunched When a user clicks a Complete Sale button after closing an opportunity. Starts background automations, such as updating records and emailing stakeholders.
When called by another flow Autolaunched or Screen When a flow executes another flow within the same running instance to reduce repetition within the main flow.
When called by Apex code Autolaunched When an Apex class is triggered by a change to an opportunity’s stage, which triggers an autolaunched flow.
When a platform event message is received Platform Event–Triggered When an integrated printer is out of ink, it publishes a platform event message.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What Can a Flow Automate?

A

AUTOMATION Example
Create records Create an account.
Update records Change a contact’s address.
Delete records Delete a user’s permission.
Send an email Send an introductory email to a lead.
Collect input from external users with an online form Let new customers add themselves to your contacts using an online form.
Collect input from internal users with a form placed on a Lightning page or launched by a button Create an account, a contact, and a case quickly with one simple form placed directly on support reps’ Home pages.
Send a custom notification Notify managers when significant opportunities are won.
Send a survey Send a customer satisfaction survey after an opportunity is closed.
Submit a record for approval Require that managers approve discounts.
Run another flow in the context of the current flow Run another flow that creates a contact within your account-creation flow.
Access external systems Call actions registered by External Services to insert details from an external banking system into a Salesforce record.
Call a custom invocable action Execute a custom Apex method that uses the InvocableMethod annotation. You decide what the action does.
Send outbound messages Initiate the reimbursement process for an approved expense report by sending a message to an external HR system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

When Do I Use Another than Flow Tool or Feature?

A

WHEN YOU WANT TO… USE… FOR EXAMPLE, YOU WANT…
1. Approve records through multiple levels in your organization. Approval Processes Two levels of management to review and approve employee PTO request records.
2. Suggest offers and actions to users that are tailored to meet your unique business criteria. Einstein Next Best Action To prompt agents to offer service contracts to customers who don’t have them.
3. Coordinate multiple flows, and assign them to multiple teams or individuals. Flow Orchestration An automated hiring process that involves HR, Finance, and the hiring team.
4. Perform an operation for more records than scheduled-triggered flows allow. Batch Apex To update all your 600,000 contacts at once.
5. Perform CPU-intensive operations. Apex To calculate a highly complex discount rate.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Einstein Next Best Action

A

Display the right recommendations to the right people at the right time with Einstein Next Best Action. Create and display offers and actions for your users that are tailored to meet your unique criteria. Develop a strategy that applies your business logic to refine those recommendations. Your strategy distills your recommendations into a few key suggestions, like a repair, a discount, or an add-on service. Display the final recommendations in your Lightning app or Experience Builder site.
Einstein Next Best Action is a solution that uses flows, strategies, and the Recommendation object to recommend actions to users. You can display these recommendations on many different types of pages, including Lightning pages in your Salesforce org, Experience Cloud sites, or external sites.
Recommendations are displayed to users with the option to accept or reject the recommended action. Each recommendation contains an image, important text values such as button text and a description, and an assigned flow that runs when a user responds. They can be stored and referenced in the Recommendation standard object, or they can be manually assembled when building a strategy.

Strategies determine which recommendations to display to users, based on your data and business processes. When you set up Einstein Next Best Action on a page, you assign a strategy to that location, which then defines the recommendations that appear there.

You can control which recommendations are displayed in any situation, even if your org has a large number of recommendation records. Strategies can filter recommendations based on any available value, including recommendation fields, fields related to the running user, and fields related to the record that’s currently displayed.

Important In Flow Builder, you define which recommendations are displayed by making sure that they’re in the outputRecommendations collection variable at the end of the flow. In Strategy Builder, you define which recommendations are displayed by making sure that they’re not filtered out when they reach the Output element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Einstein Next Best Action Example: Offer a Gift Basket to Each Account

A

To configure this Einstein Next Best Action recommendation:

  1. Create an action flow that executes when the gift basket recommendation is accepted.
  2. Create a recommendation that specifies how to present the gift basket offer.
  3. Create a recommendation strategy flow that determines when and how the recommendation is presented.
  4. Add a Next Best Action component that displays the recommendation on the Account record page and executes the strategy.

Create an Action Flow
Create a flow that collects the recipient’s name and address and sends an email to the shipping department.

From Setup, in the Quick Find box, enter Flows, select Flows, and then click 1. New Flow.
2. Select Start From Scratch and then click Next.
3. Select the Screen flow type and then click Create.
To collect the recipient’s name and address, add a Screen element to the flow.
Enter a label and API name.
Drag the Name and Address components to the canvas and assign an API name to each. Click Done.
4. To create the text of the email message to send to the shipping department, click New Resource in the Flow Builder Toolbox. If the toolbox isn’t visible, toggle the toolbox icon in the upper left corner of the Flow Builder canvas.
Add a Text Template resource type.
Enter EmailBody as the API name.
In the Body area, enter the email text, inserting the name and address resources.
Click Done.
5. To create a task for the shipping department, click + below the Screen element and add an Action element to the flow.
In the Action dropdown list, enter Send Email and select the Send Email action.
Enter a label and API name.
For Body, select the EmailBody text element.
Enter a subject line.
For Recipient Email Addresses (comma-separated), select Include and add the email address of the shipping department.
To allow rich text formatting for the message, select Include and select the True global constant.
Set any other values as needed.
Click Done.
6. Save the flow and name it Gift Basket Offer.
7. Activate the flow.
8. To return to the Flows page, click Back.

Create a Recommendation Record
Create a recommendation that specifies how to present the gift basket offer.

From the App Launcher (App Launcher icon), in the Quick Find box, enter Recommendations, and select Recommendations.
1. Click New.
2. Enter a name and description for the recommendation.
The description appears in the Next Best Action component on the Lightning record page.
3. For Action, select the action flow that you created.
To add an image (optional), click Upload Image and follow the instructions.
For best results, use a 1000 px x 380 px image at 72 dpi or one with a similar ratio.
Enter text for the acceptance and rejection buttons.
Select the target audiences for the recommendation.
Click Save.
4. The Is Action Active checkbox is automatically selected, which makes the recommendation available to Einstein Next Best Action.

Create a Recommendation Strategy Flow
The recommendation strategy flow determines when and how the recommendation is presented.

From Setup, in the Quick Find box, enter Flows, select Flows, and then click 1. New Flow.
2. Select Use a Template and then click Next.
3. Select the Recommendation Strategy flow type and then click Create.
4. To specify which records to use for the recommendation, add a Get Records element to the flow.
Enter a label and API name.
Select the Account object.
In the Filter section, add the condition Id equals recordId.
Select the options to store all records and all fields.
Click Done.
5. To load possible recommendations into the strategy, add a Get Records element.
Enter the label Get Gift Recommendation and the API name. Get_Gift_Recommendation.
Select the Recommendation object.
In the Filter section, add the condition Name contains Gift Basket.
Select the options to store all records and all fields.
Click Done.
6. In Flow Builder, you define which recommendations are displayed by making sure that they’re in the outputRecommendations collection variable at the end of the strategy flow. The next step uses the Assignment element to add the recommendations to outputRecommendations. To learn how to use the Limit Repetition element to assign the outputRecommendation variable while also limiting the number of times that the user sees the recommendation, see Create Recommendations Based on Customer Satisfaction Scores.
7. To move the recommendation output out of this flow so it becomes available to Einstein Next Best Action, click + below the Recommendation Assignment element and add an Assignment element.
Enter a label and API name.
For Variable, select outputRecommendations.
For Operator, select Equals.
For Value, select Recommendations from Get Gift Recommendation.
Click Done.
8. Save the flow and name it Gift Strategy. Activate the flow.

Display the Next Best Action Recommendation
Display the Next Best Action recommendation on the Account record page.

  1. Open an Account record page.
  2. Click the Setup icon (Setup gear icon), and select Edit Page.
    Drag the Einstein Next Best Action component to the desired location on the page layout.
  3. Add Gift Basket Offer as the component title.
  4. For Strategy Source, select Flow Builder and then select the name of the recommendation strategy
  5. Save your changes.
    Return to the Account record and refresh the page.
    The recommendation is displayed. If the account rep clicks Yes, a form opens with entries for name and address. Completing the form generates an email request for the shipping department to fulfill the order.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Einstein Next Best Actions Considerations

A

Einstein Next Best Action relies on flows, recommendations, strategies, and components, and has standard objects for reporting.

Flows
1. All Recommendation objects reference a flow. If you don’t have any flows, you can’t surface a recommendation.
2. Strategies only load recommendations with active flows.
3. When a flow is executed via REST API, the flow runs in the context of the user who is authenticated via REST API. The running user’s profile and permission sets determine the object permissions and field-level access of the flow. We recommend that you create a profile and permission sets for users who run the flow.
Recommendations
1. Consider adding a custom category field to the recommendation object and layout. A category field gives you more control when loading, sorting, and filtering recommendations and more options when creating flows.
2. Create names, descriptions, acceptance labels, and rejection labels that are appropriate for your intended audience.
3. Reusing a recommendation name creates a recommendation. It doesn’t overwrite an existing recommendation. Duplicated names can cause strategies to display duplicate recommendations to customers.
4. All flows, both inactive and active, display in the Action dropdown list. After you save your recommendation, you can see if the flow is active.
You can create a recommendation based on a flow that isn’t active, but no strategy loads it until the flow is activated.
Strategies
1. All strategies require at least one recommendation.
2. In Strategy Builder, you can load and filter the records of a Recommendation object. Or load and filter the records of any object, and convert them into recommendations at the end of the strategy using the Map element.
3. Load elements require at least one criteria.
4. Strategies only load recommendations that are based on active flows.
5. The Limit Reoffer element in Strategy Builder lets you hide a recommendation from all users based on its responses. A recommendation is hidden if users respond more than a defined number of times within a defined number of days. For limit reoffers to work, recommendations must have a unique record ID. If you want to continue to test a recommendation as a flow-entry point, delete individual records from the Recommendations Reaction table with Rest API calls:
~~~
GET /connect/recommendation-strategies/reactions
{ onBehalfOf: “005B00000018jK4IAI” }
//Returns a list of reactions
//For each result, if the reaction matches the strategyId of the strategy you’re testing:
DELETE /connect/recommendation-strategies/reactions/${reactionId}
~~~
6. Strategy Builder is available only in Lightning Experience.
Tracking and Reporting Reactions
1. For strategies created in Flow Builder, create custom report types using the Recommendation Strategy Metrics and Recommendation Responses primary objects. For strategies created in Strategy Builder, create custom report types using the Recommendation Strategy Metrics and Recommendation Reactions primary objects.
3. For reports created from the Recommendation Reactions primary object to correctly display the recommendation source name and ID for limit reoffers, recommendations must have a unique record ID.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Einstein Next Best Action Entitlements

A

Einstein Next Best Action has usage-based entitlements. All orgs receive a free monthly allowance of Next Best Action requests. If your usage exceeds your allowance of free monthly requests or any entitlements that you purchase, Salesforce contacts you to discuss additions to your contract. To track your usage, from Setup, navigate to Company Information.
Next Best Action entitlement usage is based on a rolling 30-day period, beginning when the org is created. Entitlement usage listed on the Company Information page in Setup is based on the calendar month’s usage, not the rolling 30-day usage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Einstein Next Best Action: Next Best Action Request

A

A request is a call to the Next Best Action engine that causes a strategy to run and return recommendations.

Each time a page with an Einstein Next Best Action component is loaded or refreshed in a browser, Salesforce generates a new request. For example, when a case status changes from New to In Progress, the data change on the page triggers a refresh. This action also applies to the Actions & Recommendations and Suggested Actions components.

Requests are also made when:

A field is updated on a record detail page that includes the Next Best Action component.
A user enters data in the Subject or Description field of a site contact support page that includes the Next Best Action component.
Another way to make a request is to call a Next Best Action REST API resource from your own web app. You can also call Next Best Action REST API resources from an iOS or an Android app. The app can make requests in response to a custom UI and return recommendations.

Paying customers can see the number of requests their org has made by navigating from Setup to Company Information, Usage-based Entitlements, Maximum Next Best Action Requests available.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Einstein Next Best Action:Recommendations

A

Recommendations are standard Salesforce records, similar to accounts and contacts, that are processed by strategies and associated with flows. Strategies determine which recommendation records are surfaced using business rules, predictive models, and other data sources. The result of this process is context-specific recommendations that you present to your users.
Optionally add a custom Category field to the Recommendation object and the Recommendation Layout. Adding a custom Category field can simplify loading, filtering, and sorting recommendations in Strategy Builder.
Note:
Salesforce has both a Recommendation object for Einstein Next Best Action (that’s this page) and a Recommendation component for Experience Builder sites. The Recommendation component isn’t related to Next Best Action.
If you don’t see Recommendations in the App Launcher, in Setup, select Default On in the Recommendations tab settings for your user profile or permission set.
You can load and filter the records of a Recommendation object. Or load and filter the records of any object, and convert them into recommendations at the end of a strategy using the Map element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Einstein Next Best Action:Launch a Flow When a Recommendation Is Accepted or Rejected

A

Each recommendation is associated with a single flow. By default, Next Best Action launches a flow when a user accepts a recommendation. The flow then performs an action, such as updating a case or sending an email. But you can also launch a flow when a user rejects a recommendation, which gives you more flexibility. For example, a flow could run an automated process, write to another system, or create a reminder email when a recommendation is rejected.

For example, at a telecommunications company, the admin configures the Next Best Action component to display recommendations to its customer service representatives (CSRs). When a CSR accepts a recommendation for a customer who wants to purchase a discounted service, a flow is launched to calculate the discount. The admin analyzes the reactions to the recommendation, and is confused about why the CSRs are rejecting it. To help get answers, the admin uses Next Best Action to launch a questionnaire flow every time the recommendation is rejected.

This feature is available for:

The Einstein Next Best Action component used with Lightning record pages
The Suggested Actions component used in Experience Builder
The Actions and Recommendations component used with Lightning console apps

To assign a flow that runs when a customer accepts or rejects the recommendation, create an input variable in the flow to accept the isRecommendationAccepted value. Then add a Decision element to the flow that’s based on that value.

In Flow Builder, configure a flow that’s associated with a recommendation. Be sure to activate the flow because Next Best Action can’t call an inactive flow from a recommendation.
Create the Boolean isRecommendationAccepted input variable.
Create a Decision element and use the isRecommendationAccepted variable in your outcome conditions.
Create a decision outcome for what the flow does when the recommendation is accepted.
Create a decision outcome for what the flow does when the recommendation is rejected.

When you add the Next Best Action component to a Lightning record page, select Launch Flow on Rejection.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Einstein Next Best Action:Add a Limit Repetitions Element to a Next Best Action Flow

A

You can add a Limit Repetitions element to your Recommendation Strategy flow to limit the number of times that the same recommendation or offer appears on the same record or for the same user during a time period.
You must have a collection of recommendations that has a valid value in the ID or RecommendationKey fields. The RecommendationKey value must be a database ID or have the syntax DYNAMIC_<custom>.
If you include an Assignment element, from Actions, choose Output from limit. Or you can skip this step and add the output from the Limit Repetitions element.
1. From **Setup**, in the Quick Find box, enter **Flows**, and then select Flows.
2 .Open or create a Recommendation Strategy.
3. After the collection of recommendations, add a** Limit Repetitions element**.
Enter a label and an API Name.
Add a description.
Search for and select the Recommendation Collection that you want to filter.
Select the responses that you want, and then enter the number of responses and days as whole numbers.
Look Within This Many Days is based on days, not hours. If the number of days is set to 1 for an accepted response, and the user accepts the recommendation at any time on Monday, the recommendation doesn’t display again until the start of Wednesday. So a one-day time period could be as few as 25 hours in duration or as many as 48 hours.
If you didn’t include an Assignment element, you can search for and select the collection that includes the limit repetition output.
In Advanced, select Manually assign variables.
From the Store Output Variables field, search for and select the output variable.
Click Done.
Save your work.</custom>

If you add an Assignment element after the Limit Repetitions element and change the label for accept or reject, you must update the limit repetitions output.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

Einstein Next Best Action: Building a Strategy

A

A strategy determines when and how to present an Einstein Next Best Action recommendation on a Salesforce Lightning record page. For example, if you want to offer a discount to a subset of customers, create a strategy that collects the appropriate customer records and identifies the discount option to present. To create a strategy, you can use Flow Builder (recommended) or Strategy Builder.
A Flow Builder strategy specifies business logic and generates output for an Einstein Next Best Action component on a Salesforce Lightning record page.

In a Flow Builder strategy, you generate recommendations in either of the following ways:
Use predefined recommendations created in the Recommendations object. With this method, you create recommendations individually in the Recommendation object and then use them in one or more Next Best Action components. This method is best if you’re creating a small number of recommendations.
Create recommendations on the fly without using separate recommendation records. With this method, you create multiple recommendations dynamically in the strategy flow. This method is best if you’re creating a large number of recommendations. For example, if you have an extensive product list, you can create a different upsell recommendation for each product in the list.

Build a Strategy Flow Using Predefined Recommendations
Build a strategy flow based on predefined recommendations. This method works best if you have a small number of recommendations and want to make them available to multiple Einstein Next Best Action components. For example, you can create a recommendation that offers a discount to a customer. You can then use the same recommendation when creating a strategy for birthday discounts and for new customer discounts.

  1. From Setup, in the Quick Find box, enter Flows, select Flows, and then click New Flow. On the Alt + Templates tab, select the Recommendation Strategy flow type, and click Create.
  2. Load the records you want to use for your recommendation by adding a Get Records element to the flow.
    Enter a label and API name.
    Select the object to use for the recommendations, such as the Accounts, Cases, or Contacts object.
    In the Filter section, add conditions to limit which records from the object are used in your strategy.
  3. Bring a predefined recommendation into the strategy by adding a Get Records element.
    Enter a label and API name.
    Select the Recommendations object.
    In the Filter section, use conditions to specify the recommendation that you want to use.
  4. Add other flow elements as needed to define the strategy.
    Make your recommendation available for use in an Einstein Next Best Action component.
  5. Add an Assignment element.
    For Variable, select outputRecommendations.
    For operator, select Equals.
    For Value, select the predefined recommendation.
  6. Save your flow.
    Activate your flow.

Build Strategy Using On-the-Fly Recommendations
Build a strategy flow with multiple recommendations that you create dynamically in bulk. For example, you can create a strategy that offers a different upsell recommendation for each product in your product list. With this method, you create recommendations directly in the strategy flow without using separate Recommendation records.

  1. From Setup, in the Quick Find box, enter Flows, select Flows, and then click New Flow.
    On the Alt + Templates tab, select the Recommendation Strategy flow type, and click Create.
  2. Load the records you want to use for your recommendations by adding a Get Records element to the flow.
    Enter a label and API name.
    Select the object to use for the recommendations, such as the Product object.
    In the Filter section, add conditions to limit which records from the object are used in your strategy.
  3. Add a Recommendation Assignment element.
    Enter a label and API name.
    For Record Collection Variable, select the variable that you generated with Get Records.
    When you select the variable, the target fields are populated automatically.
    Set values for the target fields:
    AcceptanceLabel—Button label to accept the offer.
    RejectionLabel—Button label to reject the offer.
    ActionFlow—API name of the flow that performs an action when the offer is accepted or rejected.
    Description—Text that appears above the buttons in the Next Best Action component.
    Make your recommendation available for use in an Einstein Next Best Action component.
  4. Add an Assignment element.
    For Variable, select outputRecommendations.
    For operator, select Equals.
    For Value, select the recommendation from the Recommendation Assignment step.
  5. Save your flow.
    Activate your flow.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Einstein Next Best Action: Display Recommendations

A

After creating a strategy, choose a page to run your strategy and display your recommendations. You can use a Lightning record page, an app’s home page, an Experience Cloud site page, a Visualforce page, or an external site, depending on where you want recommendations to appear.

Lightning Page (Lightning App Builder):

In Lightning App Builder, create, edit, or clone a record page.
Drag Einstein Next Best Action from the component list to the location on the page where you want to display it.
Choose an action strategy and the number of recommendations that you want the component to display.

An App’s Home Page:

Create a strategy for the Next Best Action component. Use global variables such as $User.Id when you create the strategy. Use global variables because the home page isn’t a record page and isn’t associated with objects, like Case, Account, or Product.
Navigate to your org’s Home page.
Click Gear icon, and select Edit Page.
From the list of Lightning components on the left (1), drag the Einstein Next Best Action component to the home page (2).

Experience Builder Site Page (Experience Builder):

In Experience Builder, create or edit a site page.
Drag Suggested Actions from the component list to the location on the page where you want to display it.
Visualforce Page: Use Lightning Out to add the lightning:nextBestAction component.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

Automated Actions

A

An automated action is a reusable component that performs some sort of action behind the scenes—like updating a field or sending an email. After you create an automated action, add it to a process, milestone, or other automated process.
Action Type:
Workflow Rule Process Flow Approval Process Entitlement Process
Email Alert x x x x x
Field Update x x x
Flow Trigger (Pilot) x
Outbound Message x x x
Task x x x

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

Email Alert Actions

A

An email alert is an email generated by an automated process and sent to the designated recipients. The action consists of the standard text and the list of recipients. You can use an email alert in an automation, such as a flow, approval process, or entitlement process. Legacy workflow rules and processes built in Process Builder or through the Invocable Actions REST API endpoint also use email alerts.
The daily allocation for emails sent through email alerts is 1,000 per standard Salesforce license per org—except for free Developer Edition and trial orgs, where the daily email allocation is 15. The overall org allocation is 2,000,000. This allocation applies to emails sent through email alerts in automations or REST API. Single emails sent to external email addresses are also limited, and how those limits are enforced depends on when your org was created.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

Outbound Message Actions

A

An outbound message sends information to a designated endpoint, like an external service. You configure outbound messages from Setup. You must configure the external endpoint and create a listener for the messages using SOAP API. You can associate outbound messages with flows, workflow rules, approval processes, or entitlement processes.

For example, automatically initiate the reimbursement process for an approved expense report by triggering an outbound API message to an external HR system.

From Setup, in the Quick Find box, enter Outbound Messages, and then select Outbound Messages. Then use these settings to configure your outbound message.

37
Q

User: Profiles

A

Each user has one profile that defines default settings. It’s possible to use profiles to grant permissions and access to users. However, we recommend you grant users the Minimum Access - Salesforce profile, and then use permission sets and permission set groups to grant users the permissions they require.

What should be in a permission set vs. a profile?

Permission Set:
User, object, and field permissions
Custom permissions
Connected app access
Apex class access
Visualforce page access
Tab settings

Profile:
Default record types
Default assigned apps
Page layout assignments
Login hours
Login IP ranges

38
Q

User: Roles

A

Roles determine what users can see in Salesforce based on where they’re located in the role hierarchy. Users at the top of the hierarchy can see all the data owned by users below them. Users at lower levels can’t see data owned by users above them, or in other branches, unless sharing rules grant them access. Roles are optional but each user can have only one. If you have an org with many users, you may find it easier to assign roles when adding users. However, you can set up a role hierarchy and assign roles to users at any time. Roles are only available in Professional, Enterprise, Unlimited, Performance, and Developer editions of Salesforce.

38
Q

Levels of Data Access

A

You can configure access to data in Salesforce at four main levels.

Organization
At the highest level, you can secure access to your organization by maintaining a list of authorized users, setting password policies, and limiting login access to certain hours and certain locations.

Objects
Object-level security provides the simplest way to control which users have access to which data. By setting permissions on a particular type of object, you can prevent a group of users from creating, viewing, editing, or deleting any records of that object. For example, you can use object permissions to ensure interviewers can view positions and job applications but not edit or delete them. We recommend you use permission sets and permission set groups to configure object permissions.

Fields
Field-level security restricts access to certain fields, even for objects a user has access to. For example, you can make the salary field in a position object invisible to interviewers but visible to hiring managers and recruiters. Field permissions are also configured in permission sets.

Records
To control data with greater precision, you can allow particular users to view an object, but then restrict the individual object records they’re allowed to see. For example, record-level access allows interviewers to see and edit their own reviews, without exposing the reviews of other interviewers. You set the default level of access that users have to each others’ records using organization-wide defaults. Then, you can use the role hierarchy, sharing rules, manual sharing, and other sharing features to open up access to records.

39
Q

Permission Sets

A

Permission sets are collections of settings and permissions that determine what users can do in Salesforce. Use permission sets to grant access to objects, fields, tabs, and other features and extend users’ access without changing their profiles.

What’s so great about permission sets? Because you can reuse smaller permission set building blocks, you can avoid creating dozens or even hundreds of profiles for each user and job function. That’s why we recommend you assign users the Minimum Access - Salesforce profiles, and then use permission sets and permission set groups to manage your users’ access.

When you create permission sets, include all permissions necessary for a job or task.

Create a Permission Set
From Setup, in the Quick Find box, enter Permission Sets, and then select Permission Sets.
Click New.
Enter your permission set’s label and description.
Optionally, you can select whether only users with certain licenses are assigned this permission set.
Click Save.
The permission set’s overview page includes sections for all the permissions and settings available to be configured. We’ll enable object, field, and user permissions.

Click Object Settings and select an object. (Or, to jump directly to an object, search for it in the Find Settings… box.)
Click Edit. From this page, you can enable object permissions and field permissions you want users assigned to this permission set to have. After you make your edits, click Save.
Click the Permission Set Overview link to return to this page.
User permissions are located in the App Permissions and System Permissions sections. For our purposes, click App Permissions.
Click Edit. To enable a user permission, select the permission’s checkbox, and then click Save.

40
Q

Permission Set Groups

A

Permission set groups are exactly what they sound like—groups of permission sets. Use permission set groups to bundle permission sets together based on a job persona or role. You can then assign a permission set group to users, rather than keep track of multiple permission set assignments. Users assigned a permission set group receive the combined permissions of all the permission sets in the group.

What makes permission set groups so powerful is that you can include a permission set in more than one permission set group. And you can mute specific permissions within a permission set group so the assigned users don’t have those permissions.

When you put all these capabilities together, you can get efficient about your reuse of permission sets. You can ensure your users have only the permissions they need for their jobs without needing to clone dozens (or hundreds!) of profiles to achieve the same setup.

41
Q

What if you don’t want to assign all of the permissions in a given permission set to users in a permission set group?

A

Muting lets you customize a permission set group by muting (disabling) selected permissions in it. To mute a permission, you add the permission to a muting permission set in the selected permission set group. When you mute a permission in a permission set group, the muting affects only users assigned to the permission set group, not users assigned directly to a permission set outside of the permission set group. So, muting offers you great flexibility when you design your permissions model.
Create a muting permission set.

From Setup, in Quick Find type Permission Set Groups and then select Permission Set Groups.
Click Sales Processing—the permission set group you created in Unit 2.
Under Permission Sets click Muting Permission Set in Group.
Click New.
For label use Contracts Permissions Muted.
For API Name, use Contracts_Permissions_Muted.
Save the muting permission set.
Select permissions to mute.

Click your muting permission set.
In the Find Settings box, enter Contracts, and then select Contracts.
Click Edit.
Mute the View All and Modify All object permissions.
Save your changes.
In the Find Settings box, enter Contracts, and then select Delete Activated Contracts.
Click Edit.
Under Sales, mute the Delete Activated Contracts permission.
Save your changes.

42
Q

Using Date, Date/Time, and Time Values in Formulas

A

Date, Date/Time, and Time fields are formatted in the user’s locale when viewed in reports and record detail pages. A Time value’s precision is in milliseconds. A Date/Time value’s precision is in seconds.
You can use operations like addition and subtraction on Date, Date/Time, and TIme values to calculate a future date or elapsed time between two dates or times. 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. The same operation between two Time values returns millisecond

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.

TODAY(), NOW()
TIMENOW() - function returns a value in GMT representing the current time without the date
DATE() function returns a Date value, given a year, month, and day.DATE( 2013, 6, 1 ) returns June 1, 2013

Converting Between Date/Time and Date
DATEVALUE( date/time ) function to return the Date value of a Date/Time.
Convert a Date value to a Date/Time using the DATETIMEVALUE( date )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.
Converting Between Date/Time and Time
TIMEVALUE(value) function to return the Time value of a Date/Time type in “HH:MM:SS.MS”
Converting Between Date and Text
TEXT() - Date to String in the format “YYYY-MM-DD”
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”.
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.
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.
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.
Converting Between Time and Text
“The time is “ & TEXT( TIMENOW() ) This function returns the time in the format “HH:MM:SS.MS”.
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.

43
Q

Cross-Object Formula

A

A Cross-object formula is a formula that spans two related objects and references merge fields on those objects. A cross-object formula can reference merge fields from a master (“parent”) object if an object is on the detail side of a master-detail relationship. A cross-object formula also works with lookup relationships.
You can reference fields from objects that are up to 10 relationships away. A cross-object formula is available anywhere formulas are used except when creating default values.
Related objects are denoted by a “>” sign.
IF( ISBLANK( Owner:User.Id ), Owner:Queue.QueueEmail, Owner:User.Email )

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).
You can’t reference cross-object formulas in roll-up summary fields.

44
Q

Formula Field Limits and Restrictions

A

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.
Save size limit — Formula fields can’t exceed 15,000 bytes when saved. If you use multi-byte characters in your formula, the save size is different from the number of characters
Compile size limit —Formula fields can’t exceed 15,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’s 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.

Default value formulas for a record type can only reference fields for that record type. But formula fields and formulas for approvals or rules for a record type can reference fields for that record type and 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, campaigns, and opportunities. 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.
The UI escapes HTML tags used in formula fields. To create an HTML element, replace your HTML with a function, like HYPERLINK or IMAGE.
Custom formula fields from contacts can’t be referenced through person accounts.
The use of NULL as an expression isn’t supported in a Checkbox formula field.

45
Q

Master-detail Object Relationship

A

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.
Behaviors of master-detail relationships:
1. 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 can’t undelete the detail record, as it no longer has a master record to relate to.
2. 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.
3. The Owner field on the detail and subdetail records isn’t 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.
4. Detail and subdetail records inherit security settings and permissions from the master record. You can’t set permissions on the detail record independently.
5. The master-detail relationship field (which is the field linking the objects) is required on the page layout of the detail and subdetail records.
6. The master object can be a standard object, such as Account or Opportunity, or a custom object.
7. As a best practice, don’t exceed 10,000 child records for a master-detail relationship.
8. Each custom object can have up to two master-detail relationships and up to 40 total relationships.
9. The Related To entry can’t be changed after you save the relationship.
A profile or a permission set can have an entity, such as Account, with a master-detail relationship. A broken permission dependency exists if the child entity has permissions that the parent should have. Salesforce updates the parent entity for a broken permission dependency on the first save action for the profile or permission set.
10. When you create a draft Knowledge Article version from a published version, the Roll Up Summary field on the draft article carries forward the Roll Up Summary field values of the published article. As per design, when you edit an article, a new draft version is created and custom field values from the published version are carried over to the new draft version. However, custom object records associated with a KnowledgeArticleVersion (published article) are not carried over or attached to the new draft version.

46
Q

Many-to-many object relationship

A

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.

47
Q

Lookup objct relationship

A

Links two objects together. Lookup relationships are similar to master-detail relationships, except they don’t support sharing or roll-up summary fields. With a lookup relationship, you can:

  1. Link two different objects.
  2. Link an object with itself (except for the user object; see the Hierarchical section in this topic). For example, link a custom object called Bug with itself to show how two different bugs are related to the same problem.

When you create a lookup relationship, you can set these options:

  1. Make the lookup field required for saving a record, requiring it on the corresponding page layout as well.
  2. 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 doesn’t 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 If you have dependencies built on the lookup relationship, such as a workflow rule, this option doesn’t allow the lookup record to be deleted.
    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.

When you define a lookup relationship, you can include a lookup field on the page layouts for that object and 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.

If the parent record in a lookup relationship is deleted, the field history tracking for the child record doesn’t record the deletion. For example, if a parent account is deleted, the Account History related list for the child account doesn’t 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.

When you delete an object used by a lookup field, delete the field, too. To delete both the object and the field, use the Metadata API with a delete manifest that uses purgeOnDelete. Or, use Setup in the UI to delete the field first. Otherwise, the object can’t be deleted.

48
Q

External lookup, Indirect lookup object relationship

A

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.

49
Q

Hierarchical object relationship

A

A special lookup relationship available for only the user object. It lets users use a lookup field to associate one user with another that doesn’t directly or indirectly refer to itself. For example, you can create a custom hierarchical relationship field to store each user’s direct manager.

50
Q

Relationship Limits

A

Each custom object can have up to 2 master-detail relationships and many lookup relationships. Each relationship is included in the maximum number of custom fields allowed.

51
Q

Converting Relationships

A

You can convert a master-detail relationship to a lookup relationship as long as no roll-up summary fields exist on the master object.
Converting a master-detail relationship to a lookup for a custom object on the “detail” side, changes the organization-wide default for the object to public read/write.
You can convert a lookup relationship to a master-detail relationship if the lookup field in all the records contains a value.
A lookup relationship can’t be changed to a master-detail relationship if the organization-wide default of the child object access level in the relationship is Controlled by Parent.
Converting a lookup to a master-detail-relationship changes the organization-wide default to Controlled by Parent and the sharing model is updated to public read/write.

52
Q

Self-Relationships

A

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 select the Direct Mail campaign in the lookup relationship, and the Direct Mail campaign can select the Holiday Promotion campaign 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.

53
Q

Master-Detail Relationships considerations

A
  1. To create multilevel master-detail relationships, you need the Customize Application user permission.
  2. When you define a master-detail relationship, the custom object on which you’re working is the detail side. Its data appears as a custom related list on page layouts for the other object.
  3. 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.
  4. You can have up to 3 custom detail levels.
  5. Standard objects can’t be on the detail side of a custom object in a master-detail relationship.
  6. An object can appear one time 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.
  7. Multilevel master-detail relationships don’t support division transfers.
  8. 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.
  9. 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. 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.
  10. You can use multilevel master-detail relationships in custom report types. The Allow Reports checkbox must be selected when you create the custom object. Custom report types created for multilevel master-detail relationships count toward the organization’s custom report type limit, and no reports generate if this limit is exceeded.
  11. 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.
  12. 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.
  13. 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 can’t undelete the detail record, as it no longer has a master record to relate to.
  14. A Metadata API deployment that includes Master-Detail relationships deletes all detail records in the Recycle Bin in these cases.
    For a deployment with a new Master-Detail field, soft delete (send to the Recycle Bin) all detail records before proceeding to deploy the Master-Detail field, or the deployment fails. During the deployment, detail records are permanently deleted from the Recycle Bin and can’t be recovered.
    For a deployment that converts a Lookup field relationship to a Master-Detail relationship, detail records must reference a master record or be soft-deleted (sent to the Recycle Bin) for the deployment to succeed. However, a successful deployment permanently deletes any detail records in the Recycle Bin.
  15. As a best practice, don’t exceed 10,000 child records for a master-detail relationship.
  16. A profile or a permission set can have an entity, such as Account, with a master-detail relationship. A broken permission dependency exists if the child entity has permissions that the parent should have. Salesforce updates the parent entity for a broken permission dependency on the first save action for the profile or permission set.
54
Q

Many-to-Many Relationships considerations

A
  1. 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.
  2. 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. 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 the sharing setting on both masters is Read-Only, a user with Read-Only rights on the master records would have Read access to the junction object.
  3. 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.
  4. The first master-detail relationship that you create on your junction object becomes the primary relationship. This relationship affects junction object records in these ways.
    1) Look and feel: The junction object’s detail and edit pages use the color and any associated icon of the primary master object.
    2) 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 don’t have a visible Owner field, this is only relevant if you later delete both master-detail relationships on your junction object.
    3) 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.
  5. 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.
  6. Roll-up summary fields that summarize data from the junction object can be created on both master objects.
  7. Formula fields and validation rules on the junction object can reference fields on both master objects.
  8. You can define Apex triggers on both master objects and the junction object.
  9. A junction object can’t be on the master side of another master-detail relationship.
  10. 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.
55
Q

Lookup Relationships considerations

A
  1. 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 doesn’t 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—If you have dependencies built on the lookup relationship, such as a workflow rule, this option doesn’t allow the lookup record to be deleted.
    Delete this record also—Available only for a custom lookup field on a custom object. This option isn’t available for a custom lookup field that refers to a standard object. Choose when the lookup field and its associated record are tightly coupled and you want to completely delete related data.
  2. 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. After B is deleted, the relationship between A and B no longer exists and C holds an empty value for the lookup.
  3. In a multilevel lookup relationship, these options can conflict. For example, if field A is the target lookup of field B, which in turn is the target lookup of field C, you can specify that A deletes B, but B can’t be deleted because it’s in a relationship with C. If you try to delete A, you get an error 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 doesn’t record the deletion. For example, if a parent account is deleted, the Account History related list for the child account doesn’t show the deletion.
    You can’t select indirect lookup fields in the parent field when you add the Related List - Single component to a Lightning Page. Instead, select the related list that’s associated with the indirect lookup field. It doesn’t show data in the related list, but shows the lookup field with no issue.
56
Q

Relationships on External Objects considerations

A

Lookup, external lookup, and indirect lookup relationships have some special behaviors and limitations.
1. Only lookup, external lookup, and indirect lookup relationships are available for external objects. No other relationship types are supported.
2. Depending on the availability of the external system, related lists of child external objects can load slowly when users view the parent record detail pages.
3. 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.
4. 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.

  1. 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.
  2. Cascade-delete isn’t available for external object relationships.
  3. 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.
  4. 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.
  5. 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).
57
Q

Impact of Relationships on Reports

A

The type of relationship you create affects which standard report types are available and how they’re 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.
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 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.

“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.

58
Q

Roll-Up Summary Field

A

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

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.”
Salesforce doesn’t recalculate the value of campaign roll-up summary fields when a lead or contact is deleted. Select the Force a mass recalculation of 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 aren’t available as the field to aggregate in a roll-up summary field.
After you create a roll-up summary field on an object, you can’t convert the object’s master-detail relationship into a lookup relationship.
Roll-up summary fields aren’t available for mapping lead fields of converted leads.

59
Q

These changes cause a mass recalculation of roll-up summary fields

A

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.

These changes cause a mass recalculation of roll-up summary fields. However, when these changes cause a recalculation of roll-up summary values, the recalculation doesn’t trigger workflow rules and field validations.
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
Selecting the Force a mass recalculation of this field option on the edit page of the roll-up summary field

60
Q

Example: Creating the Roll-Up Summary Field

A

From Setup, open Object Manager and click Account.
On the left sidebar, click Fields & Relationships.
Click New.
Choose the Roll-Up Summary field type, and click Next.
For Field Label, enter Sum of Opportunities and click Next.
The Summarized Object is the detail object that you want to summarize. Choose Opportunities.
Choose the SUM Roll-up type and choose Amount as the Field to Aggregate. If you’re unable to see Amount in Field to Aggregate, disable the Advanced Currency Management in your Currency Setup.
Click Next, Next, and Save.

61
Q

Validation Rules

A

Validation rules verify that data entered by users in records meets the standards you specify before they can save it. 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.” When the validation rule returns a value of “True”, this confirms that the data entered by the user contains an invalid value. Validation rules can also include error messages to display to users when they enter invalid values based on specified criteria. Using these rules effectively contributes to quality data. For example, you can ensure that all phone number fields contain a specified format or that discounts applied to certain products never exceed a defined percentage.
Defining Validation Rules
You can create validation rules for objects, fields, campaign members, or case milestones. In these steps, we create a validation rule that fires when a user tries to save an account with an account number of incorrect length.
Creating a Validation Rule
From Setup, go to Object Manager and click Account.
In the left sidebar, click Validation Rules.
Click New.
Enter the following properties for your validation rule:
Rule Name: Account_Number_8_Characters
Error Condition Formula: LEN( AccountNumber) <> 8
Error Message: Account number must be 8 characters long.
To check your formula for errors, click Check Syntax.
Click Save to finish.

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 begin with the word “Error”.

How to activate and deactivate validation rules.
From the management settings for the relevant object, go to Validation Rules.
Click Edit next to the rule you want to activate.
To activate the rule, select Active, and save your changes.
To deactivate the rule, deselect Active, and save your changes.

If a validation rule contains the BEGINS or CONTAINS function, it processes blank fields as valid. For example, 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.

62
Q

How Salesforce Processes Validation Rules

A

Salesforce processes rules in the following order:

Validation rules
Assignment rules
Auto-response rules
Workflow rules (with immediate actions)
Escalation rules

In addition,

  1. When one validation rule fails, Salesforce continues to check other validation rules on that field or other fields on the page and displays all error messages at once.
  2. 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.
  3. Campaign hierarchies ignore validation rules.
  4. 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.
  5. To give a default value to a division field before the validation rule evaluation, the division field must be on the page layout.
    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.

Validation Rule Field Restrictions
Validation rule formulas don’t or can’t refer to:

  1. Compound fields, including addresses, first and last names, and dependent picklists and lookups
  2. Campaign statistic fields, including statistics for individual campaigns and campaign hierarchies
  3. Merge fields for auto-number or compound address fields, such as Mailing Address
63
Q

Lookup Filters vs. Validation Rules

A

Validation rules and lookup filters achieve similar ends, but offer different advantages. Use a lookup filter:

  1. To improve user efficiency by limiting the number of available options in a lookup search dialog.
  2. To improve user efficiency by automating filters on lookup search dialogs that your users manually set.
    Use a validation rule:
  3. If you’re close to the maximum number of lookup filters allowed.
  4. To 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 to apply the rule only on record creation, or ISCHANGED to apply the rule only when a field changes.
64
Q

Lookup Filters

A

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)
The lookup object (target)
The user’s record, permissions, and role
Records directly related to the target object

For example, you can:

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.

In Lightning Experience, all lookup filters are required, even if admins specify them as optional in Setup.

For fields with required lookup filters, values that match the lookup filter criteria appear in the lookup dialog. When editing the record, users can’t save invalid values that they type in the field. If a user tries to save an invalid value, Salesforce displays an error message, which administrators can customize.
For fields with optional lookup filters (Salesforce Classic only), values that match the lookup filter criteria appear in the lookup dialog. To remove the filter and view all search results for the lookup field, users can select Show all results in the lookup dialog. Also, optional lookup filters let users save values that don’t match the lookup filter criteria without Salesforce displaying any error message.

Create:
1. From the management settings for the field’s object, go to Fields.
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.
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.
3. In the first column, click the lookup icon or start typing in the text box and select a field.
In the second column, select an operator.
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.
In the fourth column, enter the value or select the field that Salesforce should compare with the field in the first column.
4. 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.
5. Specify whether the filter is required or optional. For fields with optional lookup filters (Salesforce Classic only), values that match the lookup filter criteria appear in the lookup dialog. To remove the filter and view all search results for the lookup field, users can select Show all results in the lookup dialog. Also, optional lookup filters let users save values that don’t match the lookup filter criteria without Salesforce displaying any error message. In Lightning Experience, all filters are required, even if admins specify them as optional in Setup. There’s no Show all results view.
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.

  1. 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.
    Leave Enable this filter selected.
    Save your changes.
65
Q

Schema Builder Considerations

A
  1. Schema Builder saves the layout of your schema anytime you move an object.
  2. If your schema contains many objects and fields, loading can take a long time. Click Hide Relationships to improve Schema Builder performance.
  3. When creating a custom field, ensure that its 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 can display an unexpected value.
    If you create a field label called Email and a standard field labeled Email exists, the merge field is unable to distinguish between the fields. Adding a character to the custom field name makes it unique. For example, Email2.
  4. You can’t export your schema from Schema Builder (for example, to use the schema in another org).
  5. When you click Auto-Layout, you can’t undo it.
    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.
  6. 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 aren’t normally editable, such as formulas and roll-up summary fields, are visible and read only.
  7. You can’t save the level of zoom when closing Schema Builder.
66
Q

Schema Builder

A

Open:
From Setup, search for and click Schema Builder in the Quick Find box.
In the left panel, click Clear All.
Check Contact, Favorite, Offer, and Property. You should have the Favorite object from the previous unit, and the Offer and Property objects from the previous challenges.
Click Auto-Layout.
Create an Object with Schema Builder
In the left sidebar, click the Elements tab.
Click Object and drag it onto the canvas.
Enter information about your object. You can make it whatever you want!
Click Save.
Create Fields with Schema Builder
From the Elements tab, choose a field type and drag it onto the object you just created. Notice that you can create relationship fields, formula fields, and normal fields in Schema Builder.
Fill out the details about your new field.
Click Save.

67
Q

Data Loader

A

Download and Install Data Loader
Data Loader is available for MacOS and Windows operating systems. Download to install and configure the app on your local machine.

Data Loader is a client application for the bulk import or export of data. Use it to insert, update, delete, or export Salesforce records. When importing data, Data Loader reads, extracts, and loads data from comma-separated values (CSV) files or from a database connection. When exporting, Data Loader outputs CSV files.
Data Loader can be used on either MacOS or Windows, and offers these key features.
1. An easy-to-use wizard interface for interactive use
2. An alternative command-line interface for automated batch operations (Windows only)
3. Support for large files with up to 5 million records
4. Drag-and-drop field mapping
5. Support for all objects, including custom objects
6. Process data in both Salesforce and Database.com
7. Detailed success and error log files in CSV format
8. A built-in CSV file viewer

You can use Data Loader in two different ways:

  1. User interface—Specify configuration parameters and CSV files used for import and export, and define field mappings that map field names in your import file to field names in Salesforce.
  2. Command line (Windows only)—Specify the configuration, data sources, mappings, and actions in files. The command line enables you to set up Data Loader for automated processing.
68
Q

When to Use Data Loader

A

Data Loader complements the web-based import wizards that are accessible from the Setup menu in the online application.
Use Data Loader When:
1. You must load as many as 150,000,000 records. Data Loader is supported for loads of up to 150 million records with a maximum file size of 150 MB. If you must load more than 150 million records, we recommend you work with a Salesforce partner or visit the AppExchange for a suitable partner product.
2. You must load into an object that isn’t yet supported by Data Import Wizard.
3. Your data includes complex field mappings that you must load consistently on a regular basis.
4. You want to schedule regular data loads, such as nightly imports.
5. You want to export your data for backup purposes.
Use Data Import Wizard When:
1. You’re loading less than 50,000 records.
2. The object you must import is supported by import wizards. To see what objects they support, from Setup, enter Data Import Wizard in the Quick Find box, then select Import Wizard.
3. You want to prevent duplicates by uploading records according to account name and site, contact email address, or lead email address.
4. Your target object has fewer than 50 fields.
5. Your data doesn’t include complex field mappings.

69
Q

Introduction to Data Import

A

You can easily import external data into Salesforce. Supported data sources include any program that can save data in the comma delimited text format (.csv).

Salesforce offers two main methods for importing data.

Data Import Wizard—this tool, accessible through the Setup menu, lets you import data in common standard objects, such as contacts, leads, accounts, as well as data in custom objects. It can import up to 50,000 records at a time. It provides a simple interface to specify the configuration parameters, data sources, and the field mappings that map the field names in your import file with the field names in Salesforce.
Data Loader—this is a client application that can import up to 150 million records at a time, of any data type, either from files or a database connection. It can be operated either through the user interface or the command line. In the latter case, you need to specify data sources, field mappings, and other parameters via configuration files. This makes it possible to automate the import process, using API calls.

70
Q

Use the Data Import Wizard

A

Once you have created an export file and cleaned up the data for import, follow these steps to import data using the Data Import Wizard.

  1. Start the wizard.
    From Setup, enter Data Import Wizard in the Quick Find box, then select Data Import Wizard.
    Review the information provided on the welcome page, then click Launch Wizard!
  2. Choose the data that you want to import.
    2.1) To import accounts, contacts, leads, solutions, person accounts, or campaign members, click Standard Objects. To import custom objects, click Custom Objects.
    2.2) Specify whether you want to add new records to Salesforce, update existing records, or add and update records simultaneously.
    Specify matching and other criteria as necessary. Hover over the question marks for more information about each option.
    2.3) Specify the file that contains your data. You can specify your data file by dragging the CSV to the upload area of the page or by clicking the CSV category you’re using and then navigating to and selecting the file.
    2.4) Choose a character encoding method for your file. Most users can accept the default character encoding.
    2.5) Click Next.
  3. Map your data fields to Salesforce data fields. The Data Import Wizard tries to map as many of your data fields as possible to standard Salesforce data fields. If Salesforce can’t automatically map fields, however, you do it manually. Unmapped fields are not imported into Salesforce. To see a list of standard Salesforce data fields, from Setup, at the top of the page, click Object Manager. Click the object whose fields you’re interested in, and click Fields & Relationships. For example, if you want to see a list of standard Salesforce fields for leads, click Object Manager | Lead | Fields & Relationships.
    Scan the list of mapped data fields and locate any unmapped fields.
    Click Map to the left of each unmapped field.
    In the Map Your Field dialog box, choose the Salesforce fields you want to map to and click Map. The Map Your Field dialog box also gives you the option of saving data from unmapped fields in a general notes field for accounts and contacts. To do so, choose Account Note or Contact Note from the Map To drop-down list and click Map.
    To change mappings that Salesforce performed automatically, click Change to the left of the appropriate field, then choose the Salesforce fields you want to map to and click Map.
    Click Next.
  4. Review and start your import.
    Review your import information on the Review page. If you still have unmapped fields that you want to import, click Previous to return to the previous page and specify your mappings.
  5. Click Start Import.
  6. Check import status. From Setup, enter “Bulk Data Load Jobs” in the Quick Find box, then select Bulk Data Load Jobs. The user who starts the data import receives a status email when the import is completed.
71
Q

Export Data

A

Introduction to Data Export
You can easily export data from Salesforce, either manually or on an automatic schedule. The data is exported as a set of comma-separated values (CSV) files. Data export tools provide a convenient way to obtain a copy of your Salesforce data, either for backup or for importing into a different system.

Salesforce offers two main methods for exporting data.

Data Export Service—an in-browser service, accessible through the Setup menu. It allows you to export data manually once every 7 days (for weekly export) or 29 days (for monthly export). You can also export data automatically at weekly or monthly intervals. Weekly exports are available in Enterprise, Performance, and Unlimited Editions. In Professional Edition and Developer Edition, you can generate backup files only every 29 days, or automatically at monthly intervals only.
Data Loader—a client application that you must install separately. It can be operated either through the user interface or the command line. The latter option is useful if you want to automate the export process, or use APIs to integrate with another system.

72
Q

Using the Data Export Service

A
  1. From Setup, enter Data Export in the Quick Find box, then select Data Export and Export Now or Schedule Export.
  2. The Export Now option prepares your files for export immediately. This option is only available if enough time has passed since your last export.
  3. The Schedule Export option allows you to schedule the export process to run at monthly intervals.
  4. Select the desired encoding for your export file.
  5. If you want images, documents, attachments, and so on included in your data, select the appropriate options.
  6. Select Replace carriage returns with spaces to have spaces instead of carriage returns or line breaks in your export files. This is useful if you plan to use your export files for importing or other integrations.
  7. If you’re scheduling your export, select the frequency (only available for organizations with monthly exports), start and end dates, and time of day for your scheduled export.
  8. Under Exported Data, select the types of data to include in your export. We recommend that you select Include all data if you’re not familiar with the terminology used for some of the types of data.
  9. Click Start Export or Save. Salesforce creates a zip archive of CSV files and emails you when it’s ready. Exports will complete as soon as possible. However, we can’t guarantee the date and time the export will complete. Large exports are broken up into multiple files. Follow the link in the email or click Data Export to download the zip file. Zip files are deleted 48 hours after the email is sent.
73
Q

Get Started with Approvals

A

An approval process automates how Salesforce records are approved in your org. In an approval process, you specify:

The steps necessary for a record to be approved and who approves it at each step. For example, when an employee creates a time-off request, have Salesforce automatically send an approval request to the employee’s manager.
The actions to take based on what happens during the approval process. For example, if a time-off request is approved, update fields on the employee’s record. But if the request is rejected, send a notification to the employee.

Let’s look at an example approval process to see how a record moves through various steps of the process. In this example, a user submits a request for a new position in a company.
When a user first requests approval for a new position, initial submission actions occur. The default initial submission action locks the record. This action ensures that other users (except for approvers and admins) can’t change the record while it’s pending approval. Other possible submission actions include sending an email alert, updating a field on a record, creating a task, and sending an outbound message.

Approval steps assign approval requests to various users and define the chain of approval for a particular approval process. In this example, the first step assigns the approval request to the submitter’s direct manager.

If the direct manager rejects the request, the final rejection actions are executed, setting the position’s approval status to Rejected.

If the direct manager approves the request, the record moves to the next step—approval from the CEO. If the CEO rejects the position, the same final rejection actions occur.

If the CEO approves the position, final approval actions are executed. They set the approval status to Approved, unlock the record for future updates, and notify the employee who requested the new position.

Final approval actions occur only when a record is approved and there are no further approval steps.

74
Q

Prepare to Create an Approval Process

A

Review the following checklist before creating your approval process.

Which email template do you want to use for approval requests?
The email template you specify on an approval process is used when notifying users that an approval request is assigned to them. You can use the Salesforce default email template or create your own template. Include the appropriate approval process merge fields to link directly to the approval request. Does your org have email approval response enabled? If so, the default email template includes instructions for replying to an approval request. Type approve, approved, yes, reject, rejected, or no in the first line of the email body and add comments in the second line.

Which Chatter post template do you want to use for approval requests?
If your org has Approvals in Chatter enabled, specify an approval post template to use when notifying a user via Chatter about an assigned approval request. You can use the Salesforce default post template or create your own.

Who is the sender of approval requests?
Approval request notifications are sent from the user who submitted the record for approval. When you configure an email alert, you can add a different return email address for these notifications. You can choose the email address of the default workflow user or a previously configured and verified org-wide address. Determine which email address to use.

Who can approve requests?
Any of the following can approve or reject a request.
1. A user or queue that the approval request submitter chooses.
2. A queue specified by the administrator.
3. A user listed in the Manager standard field on the submitter’s user detail page.
4. A user listed in a custom hierarchy field on the submitter’s user detail page.
5. Any combination of users and related users (users listed in a standard or custom field on the submitted record) specified by the administrator.

Do you want approval requests delegated to another user for approval?
An approver can designate a delegate to approve requests, but you can disable this option. To assign delegates, populate the Delegated Approver field for each user’s detail page.

Which records are included in this process?
Determine what attributes a record must have to be included in your approval process. If necessary, create the custom fields to store this information so that you can use it in your filter criteria. For example, if you want to include expense records from your headquarters office only, create a custom picklist field called Office Location that has two options: “HQ” and “Field.” Then, you would specify in your filter criteria that records must have “HQ” in the Office Location field to be included in the approval process.

What happens when a record is first submitted for approval?
When users submit a record for approval, Salesforce automatically locks the record so that other users can’t change it while it’s awaiting approval. You can still add campaign members to campaigns locked for approval.

Decide if you want other workflow actions to happen when a record is first submitted, such as email alerts, tasks, field updates, and outbound messages. These actions become your initial submission actions.

Can users approve requests from a mobile device?
Determine if you want to require users to log in to Salesforce to approve requests. You can also set up your approval process to allow users to approve requests remotely using a mobile browser.

Who can edit records that are awaiting approval?
Records submitted for approval are locked. Users with the “Modify All” object-level permission for the given object or the “Modify All Data” permission can always unlock a record and edit it. You can also specify that the currently assigned approver can edit the record. You can still add campaign members to campaigns locked for approval.

Can records be automatically approved, rejected, or skipped based on certain criteria?
You can set entry criteria for each step of your process. Configure Salesforce to approve, reject, or skip the process if a record doesn’t meet the criteria. For example, all expenses submitted with an Amount less than $15 are automatically approved.

How many people have to approve these requests?
An approval process can have several layers of approvals. Determine how many users have to approve requests and in what order.

What happens when a request is approved or rejected?
When a request is recalled, approved, or rejected, Salesforce can perform up to 10 instances of each of the following types of actions—up to 40 actions total. You can also configure up to 40 actions to occur when a record has received all necessary approvals or is rejected.

75
Q

Email Approval Response
Enable Email Approval Response

A

To approve or reject this item, reply to this email with the word APPROVE, APPROVED, YES, REJECT, REJECTED, or NO in the first line of the email message, or click this link:
Link to approval request page
If replying via email you can also add comments on the second line. The comments are stored with the approval request in Salesforce CRM.

Enable Email Approval Response
From Setup, enter Process Automation Settings in the Quick Find box, then select Process Automation Settings.
Select Enable email approval response.
Save your changes.

76
Q

Choose the Right Wizard to Create an Approval Process

A

For approval processes that use a single step, use the jump start wizard. This wizard chooses some default options for you.
When your approval process is more complex and you want to define specific steps, use the standard wizard.

77
Q

Create an Email Template

A

First create your email template to notify the record owner’s manager that an opportunity has been discounted more than 40%.

  1. From Setup, enter Templates in the Quick Find box, and then select Classic Email Templates.
  2. Click New Template.
    Select Text as the template type, and click Next.
  3. Configure the email template.
    Folder: Unfiled Public Classic Email Templates
    Available for Use: selected
    Email Template Name: Approve Opportunity Discount
    Encoding: General US & Western Europe
    Subject: Please approve this discounted opportunity
    Email Body: {!User.Manager}, the {!Opportunity.Name} has been discounted. Please approve this discount. Thank you.
    Including the merge field {!Opportunity.Name} helps the approver by providing a link to the opportunity record. This allows them to review the record before responding to the request.
  4. Click Save.
78
Q

Create an Approval Process

A
  1. From Setup, enter Approval in the Quick Find box, and then select Approval Processes.
  2. In Manage Approval Processes For, select Opportunity.
    Click Create New Approval Process | Use Jump Start Wizard. The Jump Start Wizard helps you create a simple approval process by making some decisions for you.
  3. Configure the approval process.
    Name: Approve Opportunity Discount
    Approval Assignment Email Template: Approve Opportunity Discount
    Specify Entry Criteria:
    Field: Opportunity: Discount Percent
    Operator: greater than
    Value: 0.4
  4. Select Approver: Let the submitter choose the approver manually
    Save the approval process.
  5. Click View Approval Process Detail Page.
    Under Final Approval Actions, click Add New | Field Update, and configure it with these values.
    Name: Approved
    Field to Update: Discount Percent Status
    A specific value: Approved
    Click Save.
  6. Under Final Rejection Actions, click Add New | Field Update, and configure it with these values.
    Name: Not Approved
    Field to Update: Discount Percent Status
    A specific value: Not Approved
  7. Click Save.

Add Approval button
Now let’s add a button to the page layout that allows users to kick off the approval process.
1. From Setup, click the Object Manager tab.
2. Click Opportunity.
3. Click Page Layouts.
4. Select Opportunity Layout.
In the layout editor’s header bar, select Buttons.
5. Drag the Submit for Approval button to the Standard Buttons section in the page layout.
6. Click Save.

One of the available actions in the Action element is Submit for Approval, which means you can build a record-triggered flow that automatically submits a record for approval. And that means your users don’t have to remember to submit opportunities for approval. For example, you can create a record-triggered flow that’s triggered when an opportunity is edited, checks whether Discount Percent is greater than 40%, and if so, runs an Action element that submits the opportunity for approval.

79
Q

Triggers and Order of Execution

A
  1. Loads the original record from the database or initializes the record for an upsert statement.
    2.Loads the new record field values from the request and overwrites the old values. Salesforce performs different validation checks depending on the type of request.
    3.Executes before saved record-triggered flows
    4.Executes all before triggers
    5.Runs most system validation steps again, such as verifying that all required fields have a non-null value, and runs any custom validation rules. The only system validation that Salesforce doesn’t run a second time (when the request comes from a standard UI edit page) is the enforcement of layout-specific rules.
    6.Executes duplicate rules. If the duplicate rule identifies the record as a duplicate and uses the block action, the record isn’t saved and no further steps, such as after triggers and workflow rules, are taken.
    7.Saves the record to the database, but doesn’t commit yet.
    8.Executes all after triggers.
    9.Executes assignment rules.
    10.Executes auto-response rules.
    11.Executes workflow rules. If there are workflow field updates (Updates the record again. Runs system validations again. Custom validation rules, flows, duplicate rules, processes built with Process Builder, and escalation rules aren’t run again. Executes before update triggers and after update triggers, regardless of the record operation (insert or update), one more time (and only one more time))
    12.Executes escalation rules.
    13.Executes these Salesforce Flow automations, but not in a guaranteed order (Process Builder, Flows launched by workflow rules)
    14.Executes after save record-triggered flows
    15.Executes entitlement rules.
    16.If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure.
    17.f the parent record is updated, and a grandparent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the grandparent record. Grandparent record goes through save procedure.
    18.Executes Criteria Based Sharing evaluation.
    19.Commits all DML operations to the database
    20.After the changes are committed to the database, executes post-commit logic. Examples of post-commit logic (in no particular order) include:
    Sending email
    Enqueued asynchronous Apex jobs, including queueable jobs and future methods
    Asynchronous paths in record-triggered flows
80
Q

Flow Types

A

Screen Flow: Quick action, Lightning page, Experience Cloud site, and more
Autolaunched Flow: Another flow, Apex code, REST API
Autolaunched Flows automate business processes that have no UI. They have no trigger and they run in the background.
Triggered Flow: Time, Data change, Platform event
Triggered Flows are autolaunched by a trigger you specify. They run in the background.

81
Q

Scheduled Paths

A

For record-triggered flows, you can use scheduled paths to run part of a flow at a dynamically scheduled time after a triggering event.

Add a Scheduled Path to Your Flow
You can create scheduled paths for record-triggered flows that are optimized for actions and related records. You can base the scheduled time on when the record is created or updated or on a field value in the record.

Scheduled paths run in system context, so they have permission to access and modify all data. But the running user associated with the flow’s actions is the user who originally changed the record.

Before you create a scheduled path, define your org’s Default Workflow User. This setting tells Salesforce which user to default to if the user who triggered the flow is inactive. It’s possible that the default user is already set in your production org, but it’s a good idea to confirm it. You set the Default Workflow User on the Process Automation Settings page in Setup.

  1. To add a scheduled path, click Add Scheduled Paths (Optional) in a flow’s Start element. To add a scheduled path if the flow already contains scheduled paths, or to edit an existing scheduled path, click Edit.
  2. Enter a Path Label. The API Name is generated automatically.
  3. Specify a Time Source for the scheduled path. That time can be based on the triggering event or on a specified date or date/time field in the record.
  4. To run the scheduled flow path at a specified time before or after the selected Time Source, enter an Offset Number and select an Offset Option. Otherwise, enter 0 for the Offset Number.
  5. Enter a Batch Size. The default and maximum value is 200, and the minimum is 1. The batch size is the number of records that a path can process at the same time. For example, if you specify a batch size of two and you have seven records scheduled in the same time interval, they run in four batches. Use this field to avoid hitting Apex governor limits.

View pending scheduled paths on the Time-Based Workflow Setup page. From Setup, in the Quick Find box, enter Time-Based Workflow, and then select Time-Based Workflow.

82
Q

Triggered Flows

A

A triggered flow consists of a trigger, at least one criterion, and at least one action.

The trigger identifies what launches the flow. You can trigger a flow on a set schedule or when a specific type of record change occurs.
Criteria define the specifics of the trigger. The criteria for a schedule trigger are date and time. The criteria for a record change trigger are the object and specific changes to field values.
The action determines what the flow does.

Trigger Types
There are three types of triggers:
ScheduleAt a time and frequency you specify
Platform EventWhen a particular platform event message is received
RecordWhen a record is created, updated, or deleted

For record-triggered flows, the trigger determines which object the flow acts on and when it runs.

Only when a record is created
Anytime a record is updated
Anytime a record is created or updated
Only when a record is deleted

83
Q

Record-Triggered Flows

A

Fast Field UpdateRuns during the record update that triggered the flow and before that update is saved. Use: Updating the record that triggered the transaction.Showing a custom error to users
Benefit: Optimal performance because the database is minimally affected
**Related Records and Actions ** Runs during the record update that triggered the flow and after that update is saved. Use: Creating, updating, or deleting other records. Calling subflows. Calling actions, such as send email alert or post to Chatter.
Benefit: Automating common processes triggered by record changes
Run AsynchronouslyRuns immediately after the record update that triggered the flow is complete. Executing more advanced scenarios like sending requests to external systems or performing other longer running processes.
Benefit: Avoids slowing down or blocking the record update that triggered the flow
Scheduled Paths Runs in the future, after the trigger has fired, based on dates and times. Use to scheduling reminders or follow-ups based on dates in the record that triggered the flow, such as Close Date
Benefit: Waits a specified amount of time between the trigger firing and the automation running

84
Q

Reorder Your Flows

A

If you have multiple flows that are going to run from the same trigger, you may need one of those flows to run before the others. Perhaps you need one flow to edit a field before another flow uses it, or you want the related records that each flow creates to appear in a certain order. With Flow Trigger Explorer, you can change the order that flows run in without having to open each flow and change their settings.
You can also access Flow Trigger Explorer from Object Manager or from the Flows list view. To access from Object Manager, click the object with the flows you want to manage, click Flow Triggers, then click Flow Trigger Explorer. To access from the Flows list view, click Flow Trigger Explorer, next to the New Flow button.

To change the order that the flows run:
Click the Edit Order button in the section you want to reorder.
Click and hold The drag-and-drop handle next to the flow you want to reorder. Drag it to the place in the flow order that you want this flow to run.
Repeat these steps for any other flows you want to reorder in this section. Flow Trigger Explorer highlights each flow you move, so you know what’s going to be changed.
Click Update.

85
Q

Monitor Your Record-Triggered Flows

A

Time-Based Workflow page.
The Time-Based Workflow shows you individual instances of the flow so you can monitor pending automation. If you activate the Closed Won Opportunities flow, and it’s less than five days after a high value opportunity has closed, that specific automation will be listed here.

From Setup, in the Quick Find box, enter Time and then select Time-Based Workflow.
Click Search to view all pending actions for any active flows.
To filter the list of pending actions, define filter criteria (using filter type, operator, and value) and then click Search. The filter types are:
Workflow Rule, Flow, or Process Name: Enter the name of the flow.
Object: The object that triggered the flow. Enter the object name in the singular form.
Scheduled Date: The date the pending action is scheduled to run.
Created Date: The date the record that triggered the flow was created.
Automation Type: The type of automation that triggered the flow.
Created By: The user who created the record that triggered the flow.
User ID: The ID of the user who created the record that triggered the flow.
Record Name: The name of the record that triggered the flow.
The filter value is not case-sensitive.

To cancel pending actions:

Select the pending actions that you want to cancel.
Click Delete.

86
Q

SOQL Statements

A

SOQL statements evaluate to a list of sObjects, a single sObject, or an Integer for count method queries.

For example, you could retrieve a list of accounts that are named Acme:
List<Account> aa = [SELECT Id, Name FROM Account WHERE Name = 'Acme'];</Account>

Contact c = new Contact(Account = [SELECT Name FROM Account
WHERE NumberOfEmployees > 10 LIMIT 1]);
c.FirstName = ‘James’;
c.LastName = ‘Yoyce’;

Integer i = [SELECT COUNT() FROM Contact WHERE LastName = ‘Weissman’];

87
Q

SOSL Statements

A

SOSL statements evaluate to a list of lists of sObjects, where each list contains the search results for a particular sObject type. The result lists are always returned in the same order as they were specified in the SOSL query. If a SOSL query does not return any records for a specified sObject type, the search results include an empty list for that sObject.

For example, you can return a list of accounts, contacts, opportunities, and leads that begin with the phrase map:

List<List<SObject>> searchList = [FIND 'map*' IN ALL FIELDS RETURNING Account (Id, Name), Contact, Opportunity, Lead];
Account [] accounts = ((List<Account>)searchList[0]);
Contact [] contacts = ((List<Contact>)searchList[1]);
Opportunity [] opportunities = ((List<Opportunity>)searchList[2]);
Lead [] leads = ((List<Lead>)searchList[3]);</Lead></Opportunity></Contact></Account></SObject>

88
Q

SOQL vs SOSL

A

Use SOQL when you know in which objects or fields the data resides and you want to:

  1. Retrieve data from a single object or from multiple objects that are related to one another.
  2. Count the number of records that meet specified criteria.
  3. Sort results as part of the query.
  4. Retrieve data from number, date, or checkbox fields.

Use SOSL when you don’t know in which object or field the data resides and you want to:

  1. Retrieve data for a specific term that you know exists within a field. Because SOSL can tokenize multiple terms within a field and build a search index from this, SOSL searches are faster and can return more relevant results.
  2. Retrieve multiple objects and fields efficiently, and the objects might or might not be related to one another.
  3. Retrieve data for a particular division in an organization using the divisions feature, and you want to find it in the most efficient way possible.