You are here:
Null and Zero in Salesforce Spiff Functions
Some functions in Salesforce Spiff divide by zero, return null, or accept null as an argument.
Required Editions
| Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience |
| Available in: Enterprise, Unlimited, and Developer Editions |
| Available for an additional cost in: Professional Edition with Web Services API Enabled |
Divide by Zero
Some functions in Salesforce Spiff divide by zero, which causes an error. Save troubleshooting time later by handling these scenarios when you're creating your calculations.
The mamount() and mpercent() functions handle denominator values of 0 automatically.
For other functions, use an if() statement to specify an expression that executes if you anticipate that you're dividing by zero.
=if(Denominator = 0, 0, DividebyZeroErrorCalculation)Or, use the error() function to return a specific message for better error handling.
=if(Denominator = 0, error("Enter a value and try again."), DividebyZeroErrorCalculation)Test for Null Values
Formulas that return null values can cause errors or create empty data table cells. You can test for whether a record or payout rule returns a null value.
isnull(field)/field = null
field = ""If the first expression returns false and the second expression returns true, use field != "" in your data filter.
Specify Null as an Argument
To omit an argument from a function, use null for the argument value. For example, the tier_payout() function's third argument is a tiebreak value, but the function accepts up to four arguments. To ignore the tiebreak value, specify null for the correct argument location.
=tier_payout(80%, table, null, "FY2024")
