Loading

What are Derived Fields in Salesforce? How their value is set? What is the impact on Timestamps?

Publiceringsdatum: Nov 17, 2023
Beskrivning
A derived field in Salesforce is a simple field whose value is derived from the value of one or more fields on the same object.

These field values are calculated at query time when there is a change in the dependent field. However, this will not be considered an automatic updation of the derived fields as they are not updated with any trigger or automation, so the SystemModStamp will be not changed for the derived fields. 


Derived fields do not have the Create or Update supported calls so they cannot be updated manually as well, hence the LastModifiedDate of the record will also not change for the associated record.
Lösning

Derived fields are treated as formula fields and their values are calculated when it is queried and never actually stored. As the value is not stored, the record is also not modified by a user nor by the system, no update/modification of the record takes place. Hence, none of the timestamps (SystemModStamp or LastModifiedDate) are updated.

Examples of a derived field:

  • The 'Status' field on the Entitlement object is derived from the 'Start Date' and 'End Date' of the associated record. If the fields are updated manually, the  'Status' will have the values as Active/Inactive and there will be changes within the timestamps. However, if there is no change within the fields and the 'End Date' value has passed, the 'Status' will be 'Expired' and this value is set at the query time and never actually stored.
  • The 'isViolated' field on the Milestone object is derived from the 'Completion Date' and 'Target Date'. A complete understanding of this field is mentioned in this article.
  • For any custom formula field where the formula is based on comparing the Current DateTime to some Other DateTime, the formula field will change value despite no record updates occurring, no triggers firing, and no timestamps being changed. For further info, please refer to the article 'Process order for automation rules and Apex triggers'
Knowledge-artikelnummer

000396215

 
Laddar
Salesforce Help | Article