Using Salesforce Reports & Dashboards API via Apex

As Salesforce Administrator/DevOps, you might stumble to common situation where you have to mass-update or mass-delete specific records with complex filtering criteria and deep Salesforce object relationship (parent, child, or grand child).

Of course,  if you are an expert in Apex programming, you could write long and complex nested SOQL queries to get the record IDs.  But if you are comfortable with basic Apex and SOQL CRUD and not a big fan of writing complex nested SOQL to get a list of records IDs, you might consider taking advantage of Salesforce Report and use an Apex code to get the list of record IDs.

Here is a sample the Apex script that you can use to do that.

Now you have the list of the IDs from the reports. You can do other things that you want.

Posted in:

Leave a Reply

Your email address will not be published. Required fields are marked *