Can we get lastmodifiedby history of any field for which custom field tracking is enabled?

Through history like SELECT ParentId, OldValue, NewValue, Field, CreatedById, CreatedDate,lastModifiedBy from Class__History


Following up on sfdcfox's answer, if you want the person who made the last change to a field foo__c on some sobject instance:

select createdById, oldvalue, newvalue 
      from Class__History 
      where field = 'foo__c` and 
            parentId = :someParentId
      order by createdDate desc 
      limit 1
  • Nice Trick..Thanks to all especially to sfdcfox as he shared the technical reason behind this. Sfdcbox,one thing i would like to request could you please share the source where you have read this.I m really impressed by the word immutable,next time if i anyone ask me i can support myself with same technical reasons too. – David Mycka Apr 13 '16 at 16:59

Field history is immutable, and therefore does not have either LastModifiedById or LastModifiedDate. LastModifiedById and LastModifiedDate are equal to CreatedById and CreatedDate, respectively.

In the documentation for System Fields, the documentation states:

Not all standard objects have all audit fields. Check the Enterprise WSDL to verify which audit fields are available for a given object.

Generally speaking, if you can't call update on an object, there are no LastModifiedById or LastModifiedDate fields. Read the Standard Object documentation to find an object; if the "Supported Operations" section does not include "update", the Last Modified audit fields will generally not exist.

  • Thanks sfdcfox,Please share the source where can we read all the technical reasons behind the behaviors or apex.Is it in Apex documentation.It will increase the knowledge of everyone. – David Mycka Apr 13 '16 at 17:01
  • @ArunSharma There's no very specific list of objects/fields that are different, but I did find a bit of a note stating that not all audit fields are on all objects. – sfdcfox Apr 13 '16 at 17:41
  • @ArunSharma And "immutable" simply means "cannot be modified." It's a very generic programming term that you'll see in many languages, such as Java. – sfdcfox Apr 13 '16 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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