I want to automate a process where old neglected reports are automatically deleted if they were not run for X amount of days (if I can't do it in a variable/labal, I will do a source report. I am not able to finalize the deletion of the report.

If I try with Flow - the 'Report' object is not available on the list of delete objects enter image description here

If I try with Apex, (while testing code only) - I am getting that DML operation is not allowed on Report

Report[] reportsToDelete = [SELECT Id FROM report 
                         WHERE Id = '00O1o0000053rtwEAA']; 
try {
    delete reportsToDelete;
} catch (DmlException e) {
    // Process exception here

enter image description here

I also tried with Database class: same error

Database.DeleteResult reportsDR = Database.delete('00O1o0000053rtwEAA', false);

Any other option ?


Report is not a data sObject, but rather metadata. It can't be deleted like a regular record.

To delete reports, you would need to make a callout (as a user that has permission to alter metadata) via the Tooling API or the Metadata API, or perform a Metadata API destructive deployment.

  • 3
    +1 The URI would be something like DELETE /services/data/v47.0/analytics/reports/00O6F00000FW8mRUAT returning 204 No Content as response on success
    – Swetha
    Jun 6 at 21:11
  • 1
    Thank you. I can confirm the url is as @Swetha mentioned.
    – Saariko
    Jun 7 at 10:57

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.