Grid - Dynamic Formula Field
Empower your Salesforce users with GridMate's Dynamic Formula fields that reference other fields and get updated automatically as the user updates the grid. This type of fields is a powerful feature for calculating values and displaying information in real-time.
Enable Create Formula
To enable the Create Formula option, edit the Lightning page in the App Builder, select the Grid and check "Enable Create Formula"

Dynamic Formula Field Setup
Once you have enabled the Create Formula option, you can start creating formula fields as an End User. The video below is a step-by-step tutorial to learn how to use the Dynamic Formula Field👇.
Apex Formula
A basic formula combines the fields of the row with operators and functions. The value is calculated on the browser side and refreshed automatically when the user edits the row.
When the value cannot be calculated from the fields of the row (aggregations, related records, external systems...), the APEX() function delegates the calculation to an Apex class:
handleris the name of the Apex class.The next arguments are name/value pairs. The values can be fields of the row or expressions.
Apex Class
The Apex class should be global and should implement the Callable interface. GridMate runs the class for each row with the getValue action and the name/value pairs as parameters:
Our use case is to flag the won opportunities on an Opportunity User Grid. Let's create the Apex class WonOpportunities which receives the record Id and returns a boolean.
Formula Configuration
Our Apex class is ready. Let's go ahead and create the formula on the Opportunity User Grid:
Open the Grid Explorer, go to the Columns tab and select --Create New--.
Set the Type to Checkbox and the label to Won Opportunities.
Set the formula as below, click Check Syntax then Save.
Add the new Won Opportunities column to the grid and click Apply.
The returned value is displayed according to the Type of the formula: a checkbox in our example, a formatted number for Number/Currency/Percent, a formatted date for Date... When the type is Text, the returned value is rendered as rich text, so the Apex class can return HTML like a link or a badge.
Bulk Mode
By default, the Apex class is called for each row. When the grid displays many rows, set the batchSize parameter to call the Apex class once per batch of rows:
In bulk mode, GridMate calls the getValues action with a single params parameter: the JSON list of the name/value pairs of each row. The class should return the list of values in the same order.
Last updated
Was this helpful?