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
AhmedPotAhmedPot 

Getting last modified date for any field

Hi,

 

Can we get last modified date for any field via describe call or is it getting stored in some sObject. I need to track last modified by user for any sobject.

 

Thanks,

Ahmed

bob_buzzardbob_buzzard

Do you want to find the time that the contents of a field was modified or when the configuration was changed?

 

Assuming its the former, I think you'll need to use field history tracking and inspect the history table to find the last entry for the field.

AhmedPotAhmedPot

Hi,

 

Sorry for the confusion. I need to field configuration changes such as last modified time and date. I guess this would also be stored in some sObject?

 

Thanks,

Ahmed

bob_buzzardbob_buzzard

I don't think that information is stored in an sobject - at least not one that's available to us.  The configuration changes are via the metadata api, which isn't accessible from apex.  Even when accessing objects via metadata I can't see any information about when changes were made.  Its obviously somewhere, as its displayed on the UI.

AhmedPotAhmedPot

Ya. Couldn't find it anywhere. But if we check setup audit trail we can see setup changes that any user has performed. So even that details cannot be accessed using apex? May be then there is no around currently to check it out.

sfdcfoxsfdcfox

I believe the correct answer for this, as of the current release, is "not possible." I don't know of any API, normal or metadata, that will grant you the knowledge you seek. This is a setup-screen only feature, just like some other fields (like the "Custom" checkbox on profiles). 

SFAdmin5SFAdmin5

i've needed to know the last modified date for a field in formulas before and have had problems.  lastmodifieddate is for a record in general and can't be used for a specific field's last modified date. 

 

One workaround is to do this: create date field called "Date Field X Last Modified" (replace Field X with the name of the field you are interested in tracking last modified date for).  Then set up a workflow rule with criteria = to "ISCHANGED(Field X)" and set to fire whenever a record is created or edited.  Then associate a field update on this WFR that immediately updates the "Date Field X Last Modified" field with TODAY().

 

Niranjan GattupalliNiranjan Gattupalli
View Setup Audit Trail:
    The view Setup Audit Trail will track all metadata changes incluing object,fields,layouts,class,page etc..and displays latest 20 changes.
If you want to see last 6 months metadata changes need to download the csv file.
 
User-added image

    Unlike View Setup Audit Trail which displays only latest 20 records ..there is an app AutoRABIT(http://https://appexchange.salesforce.com/listingDetail?listingId=a0N30000000ptkwEAA )in appexchanage which is based on Salesforce APIs whcih can track all metdata changes based on given date/time,metadata name/type,createdby/modifiedby user etc..

   User-added image

Thanks,
Niranjan