6) Formulas and Validations

You might also like

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

3/28/23, 8:55 PM Formulas and Validations

Formulas and Validations


31 Jan 2021

These are technical notes I compiled while studying using Trailhead, Salesforce's free self-learning portal.

Use Formula Fields


Create a custom formula field and use the formula editor. Explain why formula fields are useful. Outline at least one
use case for formula fields. Create simple formulas.
Easy examples are cross-object formulas. Examples:
On Contact: Account.AccountNumber
On Opportunities: CloseDate - TODAY()
“Power of One” (can be added to any object): 1
Provides a way of counting the number of unique objects in a report with many records.
If there are a hundred opportunities in a report, but only a handful own them, creating a Unique Users
formula field with number return type and formula 1
In a report, add this new field, then summarize that field using a Sum

Implement Roll-Up Summary Fields


Describe what a roll-up summary field is. Create a roll-up summary field. Apply field-level security to your roll-up
summary field.
Roll-Up Summary fields calculate values from a set of related records, such as those in a related list
Available types: COUNT, SUM, MIN, MAX
Examples:
Sum of Opportunities on an Account
Date Opportunity First Created
Total Price of All Products Related to an Opportunity
Minimum List Price of an Opportunity
Types of fields available depend on the type of calculation:
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.

Create Validation Rules


Describe two use cases for validation rules. List the elements of a validation rule. Create a validation rule.
When the validation rule returns a value of “True”, this confirms that the data entered by the user contains an
invalid value.
Examples:
Account Number Length not correct: LEN(AccountNumber) != 8
Account Number Is Numeric: AND(NOT(ISBLANK(AccountNumber)),NOT(ISNUMBER(AccountNumber)))
Date Must Be in Current Year: YEAR( My_Date__c ) <> YEAR ( TODAY() )
Number Range Validation: (Salary_Max__c - Salary_Min__c) > 20000
Website Extension must be “.com”: AND(RIGHT( Web_Site__c, 4) <> ".COM", RIGHT( Web_Site__c, 4) <>
".com")

Site theme inspired by Chris Albon.


Unless otherwise specified, Copyright © Ryan Wingate, 2018-2023.

https://ryanwingate.com/salesforce/platform-app-builder/modules/formulas-and-validations/ 1/1

You might also like