Book Image

Salesforce CRM - The Definitive Admin Handbook

By : Paul Goodey GP, Paul Goodey
Book Image

Salesforce CRM - The Definitive Admin Handbook

By: Paul Goodey GP, Paul Goodey

Overview of this book

Table of Contents (18 chapters)
Salesforce CRM – The Definitive Admin Handbook Third Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Building formulas – best practices


Some best practices and methods to improve the creation and maintenance of formula fields are as follows:

  • Formatting with carriage returns and spacing

  • Commenting

Formatting with carriage returns and spacing

Take a look at the following formula:

Sales Tax (Percent) = 
IF(TEXT(Account.Market__c) = "US", IF(TEXT(Account.State__c) = "California", 0.0925, IF(TEXT(Account.State__c) = "Nevada", 0.081, IF(TEXT(Account.State__c) = "Utah", 0.0835, 0) )) , 0)

To improve the readability of formula fields, you can add spacing and carriage returns. The preceding formula can be made far easier to understand simply by adding spaces and carriage returns, as follows:

Sales Tax (Percent) = 
  IF( TEXT(Account.Market__c) = "US", 
    IF(TEXT(Account.State__c) = "California", 0.0925, 
    IF(TEXT(Account.State__c) = "Nevada", 0.081, 
    IF(TEXT(Account.State__c) = "Utah", 0.0835, 0) )) 
  , 0)

Commenting

Salesforce CRM allows you to put comments in your formulas. These are sections...