Problem:
- Using a custom record saved search the custom field column is showing the "Error: Invalid Expression".
- The custom field has the formula {customfield1} + {customfield2}
- This error only occurs on the custom record saved search but not when viewing the actual record.
Steps to Reproduce:
I - Create two custom lists with numeric values:
1. Navigate to Customization > Lists, Records, & Fields > Lists > New.
2. Enter a Name.
3. In the Values tab > Enter "1" in the Value column
4. Click Add. Enter up to 5.
5. Repeat Steps 1-3 to create the second custom list.
II - Create a custom record with three fields and the third field will contain the formula that will add the other two custom fields:
1. Navigate to Customization > Lists, Records, & Fields > Record Types > New.
2. Enter a Name.
3. Click Save.
4. Click New Field button.
5. Enter a Label (e.g. Variable A).
6. Enter an ID (e.g. _VariableA).
7. Set the Type = List/Record.
8. Select the value in the List/Record (first custom list created in Step I).
9. Click Save & New.
10. Enter a Label (e.g. Variable B).
11. Enter an ID (e.g. _VariableB).
12. Set Type as List/Record.
13. Select the value in the List/Record (second custom list created in Step I).
14. Click Save & New.
15. Enter a Label (e.g. Total).
16. Set the Type as Integer Number.
17. Store Value = F.
18. In the Validation & Defaulting tab > In the Default Value field enter the formula below:
{custrecord_variablea}+{custrecord_variableb}
19. Make sure that the Formula box is checked.
20. Click Save.
III - Enter data on this custom record:
1. Navigate to Customization > Lists, Records, & Fields > Record Types.
2. Look for the custom record created in Step II then click on New Record link.
3. Enter values on the fields.
4. Click Save.
5. Notice that the Total field calculates correctly.
IV - Create a custom record saved search:
1. Navigate to Lists > Search > Saved Searches > New.
2. In the Search Type select the custom record created in Step II.
3. In the Results tab, add the Total column field.
4. Click Preview.
5. Notice that you will see the ERROR: Invalid Expression in the Total column.
Solution: Add the function TO_NUMBER({customfield}) to each custom field on the formula.
1. Navigate to Customization > Lists, Records, & Fields > Record Types.
2. Edit the custom record then edit the Total field.
3. In the Validation & Defaulting tab, replace the formula with the formula below in the Default Value field:
to_number({custrecord_variablea})+to_number({custrecord_variableb})
4. Click Save.
No comments:
Post a Comment