Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I am querying a formula field in SOQL, then will it always return latest value based on data? If not then what value it will show?

share|improve this question
up vote 4 down vote accepted

Yes. Formula fields are calculated at the time of query, so they will calculate at runtime based on the currently saved values for that record.

share|improve this answer

Working with SOQL and SOSL Query Results states, in part (emphasis mine):

Also note that sObject fields that contain formulas return the value of the field at the time the SOQL or SOSL query was issued. Any changes to other fields that are used within the formula are not reflected in the formula field value until the record has been saved and re-queried in Apex. Like other read-only sObject fields, the values of the formula fields themselves cannot be changed in Apex.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.