0

I am trying to retrieve all this years report metadata. I can retrieve the single report using below package.xml code. But How do I query for this year reports and retrieve its column api name? How to write the package.xml code to query this year reports? And also is it possible to retrieve private reports using worbbench?

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Sample Reports/Opportunities_with_Contracted_Pricing_2ny</members>   
       <members>Sample Reports/New_Leads_Report_0e6</members>  
        <name>Report</name>
    </types>
    <version>53.0</version>
</Package>
7
  • 1
    Hi, Did you try writing an SOQL to get the developername from report object where createddate> some date format Sep 14, 2022 at 7:54
  • Hi @SaiPraveenKakkirala I tried this query in Query Editor from Developer Console. SELECT Id, Name, DeveloperName, FolderName,CreatedDate FROM Report WHERE CreatedDate = THIS_YEAR Sep 14, 2022 at 7:59
  • Are you facing any issue in this. Sep 14, 2022 at 8:00
  • I used this query and I fetched this year reports. But How do I use workbench to get all this year reports. Do we need to add query to package.xml code? Sep 14, 2022 at 8:05
  • 1
    you have to update the package.xml with each API name of the report I guess. I dont think we have any other process to get this. Sep 14, 2022 at 8:05

2 Answers 2

0

Using the above query from SaliPraveen you can retrieve the report folder name and developer name.

From here you have two options.

  1. retrieve all the report metadata and than extract the reports based on query results.

  2. constructing the required xml which will only retrieve the subset of reports you want. A quick way to do this is to create a visualforce page and use the repeat function to iterate over the report names. ( This is actually very little code ). With a little effort you should be able to generate the required xml.

Please remember that private reports are not visible.

3
0

You can write an SOQL to get all the reports which were created this year by using the below.

SELECT Id, Name, DeveloperName, FolderName.DeveloperName,CreatedDate FROM Report WHERE CreatedDate = THIS_YEAR

With the above query you will get the reports created this year and you need to prepare package.xml from this .

If you have more number of reports then as mentioned by @Benjamin you can go with custom code solution.

It's not possible to retrieve the contents of users' personal report (Private Reports) folders using the Metadata API.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .