3 Tips to get unstuck when creating a formula
|Knowledge Article Number||000025294|
|Description||If you can write a formula in Excel, you can write one in Salesforce. However, if you ever need help, here are 3 tips to help find a solution:
1. Check a reference
2. Write it down, then break it up
3. Ask the community
Tip 1: Check a reference
The following references explain how to use formulas and give you ideas on how to get started:
Help and Training – Click Help & Training on any Salesforce page and type in the formula function you want to use. You’ll get a description of how to use the function as well as some examples.
Formula cheat sheet – If you’re not sure which formula function to use, print this two-page cheat sheet, which lists common functions in groupings.
Useful validation rules – Don’t reinvent the wheel, modify it. Look at examples of validation rules, ranging from ensuring valid postal codes to preventing reps from being too generous with discounts on quotes. When you find a validation rule you like, customize the formula to suit your needs.
Here is the link to the Formulas - Help, Tips and Tricks user group:
Tip 2: Write it down, then break it up
If your formula gets too complicated, start from the beginning and break up it up into smaller steps.
For example, let’s say you want to assign a rating of Hot, Warm, or Cold to a lead, based on a score assigned by marketing. In addition, you want to display the rating as an image. To accomplish this task, you’ll use IF and IMAGE functions for your formula.1. First, start by using comment tags ( /* */ ) to spell out the basics. Don’t forget to add the date and your name for future reference.
2. You’ll use two IF statements in this formula. To get the first IF statement to work, use placeholders for the hot image and for the second IF statement. Then click Check Syntax to make sure there are no problems with your formula. If everything is OK, you’ll get the message “No syntax errors in merge fields or functions”; if not, the message will explain the type of error.
3. Once the first IF statement works, plug in the second IF statement, replacing the placeholder for “When not Hot.” Click Check Syntax again to check your work.
The formula works! Now all you have to do is add the IMAGE functions to display the graphics. Again, don’t forget to check your formula by clicking Check Syntax.
1. Test your formula by changing the lead scorecard on a lead. See whether the images change from Hot, Warm, and Cold when you put in a lead scorecard of 8, 6, and 4 respectively.
Tip 3: Ask the Community
If you find you need help in creating a formula and want another opinion, check out the Force.com Discussion Board: Formulas & Validation Rules Discussion to see if someone has had a similar problem. If not, become a member of the developer community and post a question of your own.