A Formula field calculates field values based on a formula expression entered during field configuration. This allows Admins to automatically derive a field’s value based on other data. Formula field values are never editable; they simply display the calculated value.
Because formula fields are calculated, rather than entered, they are not indexed, and so you cannot search or filter on formula field values. Formula fields values are not audited.
Create a Formula Field
You can add formula fields to both custom and standard objects.
To add an object field:
- Follow the basic steps for field creation described in Configuring Vault Objects.
- Select Formula as the Field Type.
- Select a Return Type.
- Enter a Formula Expression. Note that you cannot reference another formula-type field in your formula expression.
- Click Save.
For more detailed instructions on how writing the formula expression, see Creating Formulas in Vault.
Formula fields on objects support the following data types:
The Return Type must match the data type returned by your Formula Expression. Some return types allow additional options, such as Minimum value or Maximum value for numbers.
Example: Incremental Task Due Dates
You can configure a formula field that increments a User Task record’s due date. The formula below adds a date seven (7) days from the Current Due Date field value.
current_due_date__c + Days(7)
You can display icons on object records using a formula field. When configured, a formula field can display as an icon based on the formula’s evaluation. Icons display on object record list views and the object record details page.
To configure a formula field that displays an icon:
- Create a Formula type field and select Icon as the Return Type.
- Click the Calculator icon in the Formula Expression field.
- Enter your Formula Expression using the
Icon(name, color, text)function. When using the Vault formula editor, select your icon from Icons. See Vault Supported Icons.
- To show an icon in the header of an object record details page, select Show in header. To indicate whether the icon should display left- or right-aligned in the header, select Left or Right. Note that only one icon can display in the header per object.
- Click Validate. If there are errors in your formula expression, correct them.
- Click Save.
Example: Status Icons
You may want to display a status icon to indicate completion status. In the example below, Vault displays a different status icon based on a Completeness picklist value.
If(completeness__v = Picklist.completeness__v.complete__v), Icon("circle", "#00C345", "Complete"), If(completeness__v = Picklist.completeness__v.inprogress__v), Icon("adjust", "#FFA60C", "Adjust"), Icon("circle-o", "#FA2819", "In Progress")))
The “text” argument in the icon(name, color, text) formula is optional and allows you to provide alternate text for users. When users hover their cursor on the icon, this text shows up to help explain what the icon represents. If you do not provide a value, Vault shows the default alternate text for the icon.
When exporting records, the alternate text is also exported.
Available Functions & Operators
For details on available functions and operators, see the Vault Formula Reference Guide.
By default, Vault allows you to configure up to ten (10) formula fields on each object. If your configuration requires more, contact Veeva Support.
You can complete all steps in this article with the standard System Admin or Vault Owner security profile.
If you Vault uses custom security profiles, your profile must grant the following permissions:
|Security Profile||Admin: Configuration: Objects: Edit||Ability to edit Vault object configuration in order to create a formula field|
Learn more about permissions.