You are here:
Bulk Move Reports or Dashboards with Metadata API
You can move reports or dashboards between folders and subfolders in Lightning Experience. If you want to move reports or dashboards in bulk, use Metadata API.
For example, the Some Old Deprecated Folder folder contains two reports: My Accounts Report and My Opty Report. You want to move My Accounts Report to a new folder called Accounts and My Opty Report to the new Opportunities folder.
This example uses Reports and Dashboards REST API to get the details of the reports that you want to move and Metadata API to move the reports. (The same process works for dashboards.) You can use Postman or cURL to call Reports and Dashboards REST API. You can use Salesforce Extensions for Visual Studio Code or Salesforce CLI to execute Metadata API. You can follow a similar process using the force.com ANT migration tool.
- Get a list of your reports using the Reports and Dashboards REST API report resource PATCH method.
- Search the list to get the developer names of the reports you want to move and the ID of the folder they are in.
- Use the folder ID to obtain the folder’s developer name with the folder operation GET method.
-
Create a
package.xmlmanifest using the folder and file developer names as members.<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <types> <name>Report</name> <members>Some_Old_Deprecated_Folder/My_Accounts_Report_eQ</members> <members>Some_Old_Deprecated_Folder/My_Opty_Report_CO</members> </types> <version>43.0</version> </Package> -
Retrieve a package that contains the reports using the Metadata API
retrieve()call. -
Unzip the package.
-
In the unzipped package, create the new folder and file structure.
-
In the
package.xmlfile manifest, change the folder structure to match the changes that you made in the unzipped package.<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <types> <members>Accounts/My_Accounts_Report_eQ</members> <members>Opportunities/My_Opty_Report_CO</members> <name>Report</name> </types> <version>43.0</version> </Package> -
Create the new folders in Lightning Experience.
-
Create the package for deployment.
This command creates a ZIP file from the contents of the unzipped package directory called unpackaged.
zip -r move_reports.zip unpackaged/ -
Deploy the package that contains the moved reports using the Metadata API
deploy()call.
The move is complete. Some Old Deprecated Folder is empty, and you can delete it in the UI.

