Quotation marks must be straight
When using quotation marks in an expression, make sure the quotation marks are straight (“). If the quotation marks are curved (”) the Workfront system will continue to display a “Custom Expression Invalid” message.
Calculations update on form save and object edit
This is an important aspect of calculated fields to understand.
Information displayed in a calculated field will remain the same and become stale unless the custom form is recalculated.
Expressions can be refreshed by using the Recalculate Expressions option in the More menu on an object.
You want to see the number of days an issue has been open. Create a calculated field called “Days Open” with the expression DATEDIFF.
- Field Name = Days Open
- Expression = DATEDIFF({entryDate},$$TODAY)
Once saved, the number of days between when the issue was first created, or entered in Workfront, and today’s date can be shown on the details page of an object or in a report view.
When viewing the same details page or report view the following day, you expect that number to increment by one. If the number is 5 today, it should be 6 tomorrow. The next day should be 7, then 8, etc.
However, the field will continue to show 5 every day. The field has to be “re-run,” or recalculated to refresh the information.
To update a field using the Recalculate Expressions option:
- Click the name of the object to open it.
- Click the More menu.
- Select Recalculate Expressions from the list.
You can also recalculate multiple expressions at the same time by using the “bulk edit” feature in a list or report. Suppose you created a report showing a list of issues with the Days Open calculation appearing in a column. If you want to recalculate all the issues at once:
- Select all issues in the report.
- Select the edit option to bulk edit all the selected issues.
- Click on the Custom Forms label on the left to scroll down to the custom forms section.
- Check the Recalculate Custom Expressions box at the bottom of the Custom Forms section.
- Click Save Changes.
The screen refreshes to show updated information in the calculated field.
Note: Although there are other ways of updating, or recalculating, expressions in a calculated field, this is the fastest and easiest way.