6.1 1.5 - Salesforce Fundamentals - Common Use Cases For Declarative Customization

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

1- Salesforce Fundamentals – 10%

1.5 – Common Use Cases for Declarative Customization

Copyright © Walid El Horr 1


Declarative Customization
In this Chapter, we will talk about the different Declarative (non-Coding) Customization that can be achieved by
Salesforce. We will briefly explain:

• Formula Fields

• Rollup Summary Fields

• Validation Rules

• Workflow Rules

• Approval Process

• Process Builder

• Visual Workflow
Copyright © Walid El Horr 2
Formula Field
• A formula is a field type that is similar to an equation that is executed/evaluated at page read time

• Depending on the context of the formula, it can make use of various data and operations to
perform the calculation

• A formula field is Read-Only, you cannot edit it!

• A useful way to think about formulas is that they are similar to formulas on a spreadsheet. These
formulas can make use of data and operations to calculate a new value of some type

• A Formula Field can return: Checkbox, Currency, Date, Datetime, Number, Percent and Text

• A Percent formula example is calculating the margin based on the cost and selling price

Copyright © Walid El Horr 3


Formula Field – Cross Object Formula
• A formula calculate fields from within the same Object record, however;

• You can create a formula on a Object child to reference parent Object field.

• This is called Cross object formula

• Cross-Object formula is all about getting information of Parent object into Child object.

• Fetching child Object information in parent record is not done by Formula, it is done by Rollup
Summary Fields in the case of Master Detail relationship only

• An example: Formula field on the Opportunity Object, that uses fields from the Account Object to
calculate against

Copyright © Walid El Horr 4


Formula Field – Cross Object Formula
• Another Example Cross-Object Formulas: display the Account Rating Field on the Opportunity
Record.

• Note that Opportunity is child of Account.

• Account Rating field is on the Account object (it is based on many criteria)

• Go to the Opportunity – Field – New Formula field

• Call it Account Rating with Formula Type = Text

• Always go to the Advanced Formula Editor (built-in functions and cross object formulas enabled
here)

• Note that Picklist should be converted to Text to display

• Use the Text function: TEXT(Parent_Formula_MD__r.Picklist_1__c)

Copyright © Walid El Horr 5


Rollup Summary Field
• A type of field that is available only on the Master object in a Master-Detail relationship

• Used to summarize numeric value from a selected field in child Object records

• Rollup Summary Field will get information from the related child Object Records. Information types:

• Count

• SUM

• MIN

• MAX

• It is calculated when you WRITE the children (whenever any referenced detail record is saved)

Copyright © Walid El Horr 6


Rollup Summary Field
• Example:

• Opportunity Object is child of Account Object

• Opportunity Object uses a Lookup relationship to Account, but it is treated as Master-Detail relationship

• From Account, you can create a Rollup Summary Field that is used to summarize all child Opportunity
records

• When creating the Master Detail Field, you can use filters to only pull value from specific Records.
For example, only include information from Opportunities that are Closed/Won

Copyright © Walid El Horr 7


Validation Rules
• Used to enforce field requirements based on Business Logic before save
(create or update a Record)

• In other words, it is used to create conditional Requirements on Fields to


ensure clean and accurate data entry

• Validation Rules is not used to replace the Required Field option in Field
Level Security or page Layout, but for specific scenarios based on values
from other fields

• Defined using a formula that returns true or false

Copyright © Walid El Horr 8


Validation Rules
• if the formula returns true, the defined Error message is displayed and
record cannot be saved

• The formula can reference more than 1 field at a time

• The error message should clearly indicate the error

• Error message can be displayed at the top of the page or next to the field
that failed the validation rule

Copyright © Walid El Horr 9


Validation Rules
• Note: Validation Rules are case sensitive

• Validation rules will impact API usage (ex. Data Loader), web-to-lead, and
web-to-case submissions.

• Make sure to structure your validation rules so that they will not
unintentionally interfere with these operations (such as rejecting a web-
to-lead submission or Data Loader).

• So, in some scenarios, you may need to disable validation rules when
importing or updating data, and reinstate them afterwards

• Check the “Examples of Validation Rules” official Salesforce document

Copyright © Walid El Horr 10


Declarative Automation Tools
Declarative Automation Tools are tools in Salesforce that are used to perform some requirements automatically
without the need for any coding.

There are 4 Declarative Automation Tools in Salesforce:

• Workflow Rules

• Approval Process

• Process Builder

• Visual Workflow

11
Declarative Automation Tools
How to Start When it Runs What it is for
- Update Fields
- record itself
- Record Create - Immediately - parent objet - master-detail ONLY
Workflow Rules
- Record Update - Delayed Time Based - Create a Task
- Send Email
- Send Outbound Message
- Button - Update Fields
- Link - record itself
- Called from Process Builder (that includes a - parent objet - master-detail ONLY
Approval Process “Submit for Approval” action) - Immediately
- Create a Task
- Called from Visual Workflow (that includes a
“Submit for Approval” action) - Send Email

- Apex - Send Outbound Message

Copyright © Walid El Horr 12


Declarative Automation Tools
How to Start When it Runs What it is for
- Update Fields
- record itself
- parent objet - master-detail OR look-up
- child object

- Record Create - Send Email


Process Builder - Record Update - Immediately - Create a Record
(Lightning) - Called from Process Builder (With invocable - Delayed Time Based - Submit for Approval
processes – WIN 17) - Call Visual Workflow
- Call another Process (Invocable)
- Call Apex (can be used to send outbound message also)
- Post to Chatter
- Quick Action

Copyright © Walid El Horr 13


Declarative Automation Tools
How to Start When it Runs What it is for
- Accept user input
- Call Apex (can be used to send outbound message also)
- Create Records
- Delete Records
- Button - Post to Chatter
- Link - Immediately - Send Email
Visual Workflow
- Called from Process Builder - Can be paused - Submit for Approval
- Apex - Update fields in any record
- Quick Action
- Query Records
- Loop Records
- Multiple Decisions

Copyright © Walid El Horr 14


Summary
In this chapter, you learned:

• Formula Field: a read-only field used to calculate other field values from the same record, or from Parent Object
records. It can have these types - Checkbox, Currency, Date, Datetime, Number, Percent and Text

• Rollup Summary Field: a read-only field used to calculate child Object records count, sum, min or max in a
Master-Detail relationship only

• Validation Rules: used to enforce conditional requirements on fields to ensure clean and accurate data entry

Copyright © Walid El Horr 15


Summary
In this chapter, you learned:

• Workflow Rules: automation tool that is invoked on record creation or update. It can update fields on the record
itself, or its parent (MD only), create a task, send an email or send an outbound message.

• Approval Process: automated approval tool that is invoked by a button link, Process, Flow or Apex code. It can
update fields on the record itself, or its parent (MD only), create a task, send an email or send an outbound
message.

• Process Builder: automation tool that is invoked on record creation or update, or by another Process. It can
update fields on any related record, create a record, post to chatter, invoke a process, a Flow, and Approval…etc

• Visual workflow: automated approval tool that is invoked by a button link, Process or Apex code. It can accept
User Input, Create and Delete records…etc.

Copyright © Walid El Horr 16


Declarative Customization

Thanks for Watching! 

Copyright © Walid El Horr 17

You might also like