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
Consider 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 in the following snippet:
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...