0

How to get LastModifiedDate of Custom Field or Custom Label by Metadata API in Java?

Edit: I found a link:

https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/customfield.htm?search_text=LastModifiedDate

and the text there:

"Other standard fields aren't supported, including system fields (such as CreatedById or LastModifiedDate) and autonumber fields.Some standard picklist fields aren’t supported."

...

So it seems, that my field Memes__c.Flipping_Tables__c.LastModifiedDate will not work.

1

The documentation snippet you refer to is explaining a limitation on which standard fields on an object you can retrieve with the Metadata API. There's a difference between retrieving the metadata for the standard field LastModifiedDate and retrieving the last modified date of some custom field.

However, as far as I'm aware, neither the Metadata API's CustomField entity nor the Tooling API's EntityParticle provides this information.

You can issue queries against the Setup Audit Trail to find a historical snapshot of this kind of change, although it's subject to the limitations of that feature (limited retention; query limitations; based on time rather than a per-field history). For example, you can do

SELECT Section, Display, Action, CreatedBy.Name, CreatedDate 
FROM SetupAuditTrail 
WHERE Action = 'createdCFCustom'

to get back a list of Custom Field creation events during the course of the Audit Trail's retention window. Unfortunately, the information is not structured all that well for machine parsing.

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.