5

Is there a way to create a package.xml contains all reports through Code.? I have tried listMetadata also, but could not create the xml with all the reports.

  • listMetadata requires a known folder name, so you need to enumerate the folders first, which it seems cannot be done via listMetadata, though can be queried via SOQL. Are you using Ant or Java here? – Andrew Fawcett Aug 19 '13 at 15:35
  • I'm using Ant here. I want to write a .bat file to take back up of reports automatically. In time, if new reports has been added,how can i update the *.xml. – amidstCloud Aug 20 '13 at 6:21
2

You can't use the "*" wildcard on Report metadata components so the answer above is inaccurate.

You have to list out each member with FolderName/ReportName for each. The article below from Salesforce's Metadata API guide speaks to more dynamic ways to accomplish this, but it's a little beyond my understanding at the moment.

https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_report.htm

| improve this answer | |
1

Here is alternative way to retrieve all reports.

You can’t use the wildcard (*) symbol to retrieve all reports in package.xml,

query all your reports in your report object (SELECT Name, DeveloperName, FolderName FROM Report) using Workbench/Developer Console and form it in your package.xml

Refer: http://theblogreaders.com/retrieve-unfiled-public-reports-using-salesforce-package-xml/

Thanks & Regards, Sakthivel Madesh

| improve this answer | |
0

In the Dev Console, run:

List<Report> reports = [SELECT FolderName, DeveloperName FROM Report];
String s = '';
for (Report r : reports) {
    s += '<members>' + r.FolderName + '/' + r.DeveloperName + '</members>\n';
}
Task t = new Task();
t.Description  = s;
insert t;

System.debug(t.Id);

Then go check that Task's Comments field.

| improve this answer | |

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.