5

how to get all the metadata changes after a given date.

Tried using metadata api's listMetadata(), this gives all the data and here we can't filter using dates. This will run into limits for reports and custom fields.

Is there a way to filter metadata changes by lastmodifieddate, createdbyid ?

2

3 Answers 3

8

For objects supported by Tooling API, you can simply write a query for this. Open the Developer Console, click on the Query tab, enter the Tooling API query, and check the "Use Tooling API" checkbox.

Example

SELECT TableEnumOrId, DeveloperName FROM CustomField WHERE LastModifiedDate > 2018-09-01T00:00:00.000Z

Note: This means you'll have to query all tables you want separately.

Note 2: Not all objects are supported, so if that's the case, you might need to source an alternative method, like querying the SetupAuditTrail and parsing manually. This goes back about six months, though.

1
  • Do we have tables for all metadata types like reports, workflowrules etc ?
    – ab0369
    Dec 19, 2018 at 15:30
3

Trying to retrieve date information from the Tooling API is quite difficult. The results will vary depending on which call is made and what Metadata Types are supported.

A much easier way is to Retrieve the Metadata in question. Look at the checkRetrieveStatusResponse structure. Under fileProperties you will see createdByName, createdDate, lastModifiedByName and lastModifiedDate. This method returns all of the data information in one API call.

4
  • I want list of metadata that is modified after a given date
    – ab0369
    Jan 4, 2019 at 16:12
  • 1
    Right. Do a retrieve of the relevant Metadata Types, look through the checkRetrieveStatusResponse structure, and find the dates that are after your given date. Then compile a list of those metadata types. There is no automatic or simple method to get this information. Jan 4, 2019 at 19:46
  • I tried that too but for customfields I cannot use it as it gives me limit error 10000 or 39mb
    – ab0369
    Jan 4, 2019 at 21:10
  • 1
    You are looking at a gigantic org. You can divide the transaction into pieces and everything will work the same way. For Custom Field dates the Tooling API is a better choice. The Metadata API will only give you dates for Custom Objects, but the Tooling API will give you dates for individual fields. Jan 4, 2019 at 22:50
0

There is no single api that provides list of changed metadata components. The best thing we have achieved is to make multiple listMetadata calls (op alludes to it).

listMetadata can take up to 3 types whose components needs to be listed and it returns all components for those types.

For foldered types (Report, Dashboard, EmailTemplate, Document) it is little bit involved. First you need to list all folders using corresponding folder type and then make subsequent calls with combination of folder name and component type (again upto 3 requests per call).

Once you list the components, you can filter out the components locally by comparing the lastModifiedDate

We have found that this api has supported any big sized org that we have had to deal with so far to list the components.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .