Resolve Error: "Invalid Expression" When Adding a Custom Field in a Saved Search Result
Published on
June 14, 2023 at 11:47:14 PM PDT June 14, 2023 at 11:47:14 PM PDTth, June 14, 2023 at 11:47:14 PM PDT
Scenario
When adding a Custom Field with a formula that computes its value from other Custom Fields that may have different Field Types on a Saved Search, the result shows "Error: Invalid Expression".
The Custom Field is working as designed on actual records but the loading of formula in searches does not work. The Saved Search is not capable of computing the value of other Custom Fields since their values are treated as text, not numbers.
Solution
- Navigate to Customization>Lists, Records, & Fields>Transaction Body Fields
Note:This is also applicable for other Field Type such as Entity fields. - Preferred Custom Field:ClickEdit
- Click Validation & Defaulting
- Default Value:EnterTO_NUMBER({custbody1})* TO_NUMBER({custbody2}) * {custbody3}
Note:The TO_NUMBER() function should be used on the Custom Field that is not a number. Change the Field IDs accordingly. - Click Save