I would like to clean up old reports on an annual basis. Is there a way to move old reports to a separate folder where after 30 days I would go and do a mass delete?

  • What are your criteria for an old report? A report that hasn't been run over a number of days? May 3 '16 at 16:57
  • A report that has not been run for a year
    – olisa25
    May 3 '16 at 20:45

You can query for this information in Apex, and you could send out an email alert via a scheduled job for reports that have gotten stale. Here is the SOQL you would need to find anything that hasn't been run in the last 30 days:

SELECT Name, FolderName FROM Report WHERE LastRunDate < LAST_N_DAYS:30

If you want to change the folder or delete anything via Apex, you will need to use the Metadata API.

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.