Aggregating & Validating Data

Aggregating and validating data is fundamental to every enterprise application and so is true for Salesforce. This episode talks about putting validations within Salesforce to enforce data integrity and aggregating relational records.

We will also learn about Formula field in Salesforce, roll up summaries field, validation rules examples and use of Duplicate Rules.

Introduction Formula Fields

  • Formulas calculate values automatically based on other fields and formula inputted
  • Use field level security to hide sensitive information
  • Types of operators support by Formula fields
    • Math
    • Logical
    • Text
    • Types of functions support by Formula fields
    • Date and time
  • Logical
    • Math
    • Text
    • Summary
  • Advance (REGEX, ISCHANGED etc.)

Formula Fields – Things to remember

  • “#Error!” displays for a formula field whenever an error occurs while calculating the value of a formula
  • “#Too Big!” displays if your formula output is over 18 digits
  • Prevent division by zero errors by including an IF function that determines if the value of a field is zero. For example, IF(Field__c =0,0, 25/Field__c).

Introduction to Roll-up Summary

  • Calculate values from related records
  • Master-detail relationship
  • Types of calculations with Roll-up summary fields
    • Count
    • Sum
    • Minimum value
    • Maximum value

Roll-up Summary – Things to remember

  • Fields you can calculate in a roll-up summary field depend on the type of calculation.
    • Number, currency and percent fields are available when you select SUM as 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!”
  • When you delete a child record on a roll-up Summary field, Salesforce doesn’t recalculate the value of the field. Select the Force a mass recalculation 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
  • After you have created a roll-up summary field on an object, you cannot convert the object’s master-detail relationship into a lookup relationship
  • Roll-up summary fields are not available for mapping lead fields of converted leads

Introduction to Validation Rules

  • Validation rules verify that data entered by user meets standard you specify
  • Validation rule can contains formula or expression that evaluates the data
  • Validation rules can also include error messages to display to users
  • Elements of Validation Rule
    • Formula
    • Error Message
    • Error Location
    • Description

Validation Rules – Things to remember

  • Be careful, not to create contradicting validation rules for same field; otherwise user won’t be able to save the record
  • When referencing related fields in a validation formula, make sure those objects are deployed
  • Keep in mind that when a validation rule contains the BEGINS or CONTAINS function, it processes blank fields as valid
  • Assign corresponding numbers to validation rules and their error messages. This allows you to identify the source of the error
  • A poorly designed validation rule can prevent users from saving valid data. Make sure you thoroughly test a validation rule before activating it

Introduction to Duplicate Rules

  • Duplicate rule defines what happens when user view or create duplicate record
  • Matching rules and duplicate rules work together to ensure your org data is duplicate free
  • Each standard duplicate rule includes a corresponding standard matching rule that determines how records are identified as duplicates
  • Standard duplicate rules are available for
    • Account
    • Person Account
    • Contact
    • Lead

Duplicate Rules – Things to remember

  • You can use up to 5 active duplicate rules per object
  • If the first duplicate rule finds a match for a particular record, subsequent duplicate rules skip that record
  • Conditions Under Which Duplicate Rules Don’t Run
    • Records are created using Quick Create or Community Self-Registration
    • Leads are converted to accounts or contacts
    • Records are restored with the Undelete button
    • Records are added using Lightning Sync
    • Records are manually merged
  • Conditions Under Which Duplicate Rule Settings Are Overridden
    • Records are added using the data import tools
    • Records are added or edited using Salesforce APIs
    • A person account is converted to a business account, and the newly created business account matches an existing business account
  • Translation Workbench doesn’t support the customizable alert text in duplicate rules

Here is recording of session

YouTube video

Episode 4 was presented by Purushottam Bhaigade on Aug 6, 2019 at 7 PM Indian Standard Time.

Further Learning

  1. Formulas & Validations
  2. Duplicate Management

Here is playlist link for all recording. Please check Episode 5 to learn about “Automating Business Processes with Salesforce – Part 1” .

Thanks,
Salesforce Apex Hours

Jigar Shah
Jigar Shah
Articles: 15

One comment

  1. Hi Team , I just started with Salesforce and following your course . is there a way can I get this PPT used in this session

Leave a Reply

Your email address will not be published. Required fields are marked *