Expression Field
Expression fields are similar to formula fields. Unlike formula fields, expression fields can be used for sorting, totaling, and filtering of records in views. Expression field values are updated when a record is updated, while formula field values update dynamically with any change.
The New Field screen for a Expression field includes:
-
Field Properties
-
Field Label — (mandatory) is displayed on the left from the field on view, edit, and new record pages.
-
View Header — (optional) is used in headers of views and reports. If not specified, the Field Label is used.
-
View Width — (optional) is used to set width (in pixels or %) of columns in views and reports. If not specified, the browser calculates the width of columns automatically.
-
Hide this field's label on UI pages — An optional checkbox for hiding the display label of the field on UI Pages.
-
Return Type — The return type, which can be
Decimal
,Currency
,Integer
,String
,Boolean
,Date
orDate/Time
.-
The currency format (only for fields with a
Currency
return type). -
The number of decimal places (only for fields with
Decimal
return type).
-
-
Formula Editor — Defines the JavaScript expression. You can use merge fields from the current object record and related records to return a dynamically computed value. This value can be numeric or strings. Strings can consist of plain text, rich HTML, or JavaScript code that will be executed on the client's browser. For more information about formulas, including examples, see Formulas.
-
-
Advanced Field Properties — For more information, see Advanced field properties.
-
Integration Name — The integration name is used to reference this field via merge fields or with Platform APIs.
-
Field-Level Help — The Field-Level Help box allows you to define help text for the field that will appear in a popup when the user clicks the help icon next to the field.
Expression fields have the following limitations:
- Expression field values are updated when the containing record is updated — not when the record is viewed.
- The data type of an expression field cannot be changed.
- Unlike formula fields, expression fields are stored in the database, so they are subject to limitations on the number of columns per object.
-
For any new records, expression fields added as part of Record name template is evaluated only after an update.
A list of most important features of Expression Fields is given below.
- Related Object Token Support
The Template Helper box in the Expression field displays the related object tokens. These tokens can be used to write any JavaScript formula to be evaluated as part of expression. Considering the scenario of a Loan Management Application – Loan Type is displayed as a related object.
- Field Dependency Selection
Field Dependency is a list of fields associated in an expression javascript formula. The expression field re-calculates when any of the field present in the dependency list is updated. The user can move any of the available fields to/from the assigned list.
On the click of Compute Dependency, Platform identifies a list of field tokens used in formulas and pull respective field(s) from current object definition to Assigned Field section in dependency list.
On the selection of Any Field option under the Available Field List, Platform ensures the expression field is updated on any update of the field present in the dependency list within a given object definition. From the above screenshot, any update to the related object – Loan Type re-calculates the expression field while disabling the remaining available list of fields.
Note:- Compute dependency does not to pull fields from any other related object definition.
- In case the user wishes to select any individual fields, ensure the Any Field option is removed from the Assigned Fields.
- Reset Expression Field
This option re-calculates any given single expression field for all data records for the object definition. This action can be performed on the Expression Field Definition view page.
On the click of Reset, a dialog prompts for the reset of the data under this expression field.
Reset of Expression Field can also be performed on the Customer Data Maintenance page.