stevemo webinar: hit a home run with formula & analytics tricks
DESCRIPTION
* Deal with a picklist field * Prevent new accounts creation during lead conversion * Create unique dynamic reports and list views * Enhance Salesforce with custom formulas, and much more!TRANSCRIPT
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Thanks for joining today’s webinar
Formula and Analytics Tips
& Tricks With Steve Molis (SteveMo)
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
•Using the ISPICKVAL and CASE Functions
•Creating an Opportunity Rollback Validation Rule
•Using the TEXT Function to convert Picklist Values
* No Animals Were Harmed in the Making of These Formulas
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Formula and Analytics Tips & Tricks
•How to block Account Create via Lead Convert
•Counting Multi-Select Picklist Values*
•Summarize Checkbox Fields
•Create Dynamic Month to Date Reports
* Some Animals Were Harmed in the Making of These Formulas
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Function: ISPICKVAL (aka “old faithful”)
Description: Determines if the value of a picklist field is
equal to a text literal you specify.
Example:
IF(ISPICKVAL(Weather, "Zombies!"), "RUN!!!",
IF(ISPICKVAL(Weather, "HOT"), "Go Swimming",
IF(ISPICKVAL(Weather, "WARM"), “Have a picnic",
IF(ISPICKVAL(Weather, "COLD"), "Sit by the fire",
"Send out for Pizza"))))
Function: CASE
Description: Checks a given expression against a series of
values.
Example:
CASE(Weather,
"Zombies!", "RUN!!!",
"HOT", "Go Swimming",
"WARM", “Have a picnic",
"COLD", "Sit by the fire",
"Send out for Pizza")
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Business Requirement
Prevent user from changing the Opportunity Stage to a
previous Opportunity Stage
Solution
Use a Validation Rule to evaluate current Opportunity
Stage and compare it to the previous Opportunity Stage
Fields Referenced
Opportunity: StageName
Functions and Operators Used
CASE
PRIORVALUE
<
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
CASE( StageName ,
"Prospecting", 1,
"Qualification", 2,
"Needs Analysis", 3,
"Value Proposition", 4,
"Proposal/Price Quote", 5,
"Negotiation/Review", 6,
"Closed - Won", 7,
"Closed - Lost", 7,
0)
<
CASE(PRIORVALUE(StageName),
"Prospecting", 1,
"Qualification", 2,
"Needs Analysis", 3,
"Value Proposition", 4,
"Proposal/Price Quote", 5,
"Negotiation/Review", 6,
"Closed - Won", 7,
"Closed - Lost", 7,
0)
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Function:
TEXT
Description:
Converts picklist values to text in Validation Rules, Formula Fields, and Workflow Field Updates.
So that you can do stuff like this…
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
• TEXT
• Operators: > < = >= <= <>
• ISBLANK
• VALUE
• BEGINS
• CONTAINS
• LEFT/RIGHT
• FIND/SUBSTITUTE
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Problem:
Make a custom picklist field
called “Loss Reason”
required if the Opportunity
Stage is Closed/Lost.
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Solution:
Create a Validation Rule
Formula:
AND(
TEXT(StageName) = "Closed Lost",
ISBLANK(TEXT(Loss_Reason__c)))
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Problem:
Calculate the Opportunity
Discount Amount from
Discount% (a custom
picklist field)
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Solution:
Create a custom field
Datatype: Formula
Result: Currency
Formula:
Amount *
(VALUE(TEXT( Discount_Pct__c ))
/ 100)
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Tip #2:
Create a custom
Enhanced List View
or Report to
double-check your
Formulas
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Problem:
Require priority 1-3 for
any “Existing
Customer”
opportunities.
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Solution:
Create a Validation Rule
Formula:
AND(
BEGINS(TEXT(Type),"Existing"),
VALUE(TEXT( Priority__c )) > 3))
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Problem:
Do not allow “Renewal”
Cases for Inactive
Accounts
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Solution:
Create a Validation Rule
Formula:
AND(
Account.Active__c = FALSE,
CONTAINS( TEXT(Status) ,
"Renewal"))
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Problem:
Extract the Numeric Value from the end of Picklist
Values that contain mixed length text characters.
Use Case:
Approval Processes, Workflow Rules, Validation
Rules, Formula Fields.
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
CASE Formula:
CASE( SLA__c ,
"Diamond 5.0", 5.0,
"Platinum 4.0", 4.0,
"Gold 2.5", 2.5,
"Silver 1.5", 1.5,
"Bronze 0.5", 0.5,
0)
Compiled size:
5 Values = 326 bytes
10 Values = 426 bytes
Nested IF Formula:
IF(ISPICKVAL(SLA__c ,"Diamond 5.0"), 5.0,
IF(ISPICKVAL(SLA__c ,"Platinum 4.0"), 4.0,
IF(ISPICKVAL(SLA__c ,"Gold 2.5"), 2.5,
IF(ISPICKVAL(SLA__c ,"Silver 1.5"), 1.5,
IF(ISPICKVAL(SLA__c ,"Bronze 0.5"), 0.5,
0)))))
Compiled size:
5 Values = 465 bytes
10 Values = 950 bytes
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Solution:
Formula:
VALUE( RIGHT ( TEXT ( SLA__c ), 3 ))
Compiled size: 280 bytes
• Use the TEXT function to convert the Picklist
Value to a Text String.
• Then use the RIGHT function to extract the
last 3 characters or the Text String.
• Then use the VALUE function to convert the
last 3 characters to a Numeric Value.
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Field Name: Bottles of Beer on the Wall
Dataype: Picklist
100 Values:
100 - Bottles of Beer
99 - Bottles of Beer
98 - Bottles of Beer
97 - Bottles of Beer
96 - Bottles of Beer
95 - Bottles of Beer
94 - Bottles of Beer …
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Dataype: Formula
Result: Number
Formula:
VALUE(TRIM(LEFT(TEXT(Bottles_of_Beer_on_the_Wall__c),
FIND(" - ", TEXT(Bottles_of_Beer_on_the_Wall__c)))))
Compiled size:
ISPICKVAL = 7,602 characters
CASE = 6,478 bytes
TEXT = 546 bytes
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
> 1 way to deal with a Picklist field
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Formula and Analytics Tips & Tricks
•How to block Account Create via Lead Convert
•Counting Multi-Select Picklist Values*
•Summarize Checkbox Fields
•Create Dynamic Month to Date Reports
* Some Animals Were Harmed in the Making of These Formulas
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Prevent new Accounts during Lead Convert
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Prevent new Accounts during Lead Convert Business Requirement
•Prevent user from creating new Accounts but allow them to convert Leads to new Contacts
and Opportunities
Solution
•Use a Validation Rule to block new Account create.
Fields Referenced (optional)
•$Profile.Name
•$Role.Name
•$User.Id
Function Used
•ISNEW()
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Prevent new Accounts during Lead Convert
Formula:
AND(
ISNEW(),
$Profile.Name = “Sales User”)
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Counting Multi-Picklist Values
Business Requirement
Need to get the count of items selected from an
Multi-Picklist field on the Opportunity to get the
item count per Sales Rep
Solution
Use a Formula to evaluate the Multi-Picklist
field and return a numeric value for each item
selected and sum the numeric values
Functions and Operators Used
IF
INCLUDES
+
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Counting Multi-Picklist Values
Create a custom field
Datatype: Formula
Return Type: Number, 0 decimals
Formula:
IF( INCLUDES( What_s_for_dinner__c , "Pizza"), 1, 0) +
IF( INCLUDES( What_s_for_dinner__c , "Lobster"), 1, 0) +
IF( INCLUDES( What_s_for_dinner__c , "Beer"), 1, 0) +
IF( INCLUDES( What_s_for_dinner__c , "Wine"), 1, 0) +
IF( INCLUDES( What_s_for_dinner__c , "Cake"), 1, 0) +
IF( INCLUDES( What_s_for_dinner__c , "Ice Cream"), 1, 0)
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Converting Checkbox Fields for Summary Reports
Problem
• Display the “summarized” Opportunity Stage /
Status in List Views, Reports and Dashboards.
• Ugly Reports and Charts
Solution
• Use a Formula to evaluate IsWon and
IsClosed checkbox fields and return a
text value.
Functions and Fields Used
• IF
• IsWon
• IsClosed
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Converting Checkbox Fields for Summary
Reports Solution:
Custom field
Datatype = Formula
Result = Text
Formula:
IF(IsWon, "Won",
IF(IsClosed, "Lost",
"Open"))
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Converting Checkbox Fields for Summary Reports
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Report on Month to Date Sales
Problem
• Create a dynamic report of the Month to Date for opportunity trend analysis.
Solution
• Use a Formula to evaluate Close Date (Number) and compare to current day (Number)
Functions and Operators Used
• DAY
• TODAY()
• <=
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Report on Month-to-Date Sales
Custom Field
Datatype = Formula
Result = Checkbox
Formula
DAY(CloseDate) <= DAY(TODAY())
Copyright © Panaya
Twitter: @panayacg
Email: [email protected]
Formula Resources
• Introduction to Formulas -
http://wiki.developerforce.com/page/An_Introduction_to_Formulas
• Formulas Quick Reference Guide -
https://na1.salesforce.com/help/pdfs/en/salesforce_formulas_cheatsheet.p
df
• Useful Validation Rules -
http://na1.salesforce.com/help/pdfs/en/salesforce_useful_validation_formu
las.pdf
• Building a Cross Object Formula -
https://help.salesforce.com/HTViewHelpDoc?id=fields_creating_cross_objec
t_advanced.htm&language=en_US