function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Soql in Formulas

I would like to create a filed that returns the count for a soql query.


I thought I could intially put the soql query in the formula of a custom field however this is not the case.


Can anyone point me in the direction of setting this up?





You can't execute a SOQL query from any field in the UI.

You have basically 2 choices, one, create a rollup summary field, if the object you are counting is related to the object you want to put the field on.  Two, create a trigger that executes your query and updates the custom field.


Hello Jim


thanks for the comment. If I were to go for the latter is there anywhere you can point to where I can find documentation in setting this up?