0

I need to check if a field is being used in any of the reports in the org. So I created a sandbox environment and created a manifest project in VScode; then authorized the sandbox org and ran the command "SFDX: Retrieve Source in Manifest from Org" by right clicking the package.xml file. All the apex classes and triggers were retrieved but the reports meta data were not retrieved. Here's the content of the package.xml file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTestSuite</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTrigger</name>
    </types>
    <types>
        <members>*</members>
        <name>AuraDefinitionBundle</name>
    </types>
    <types>
        <members>*</members>
        <name>LightningComponentBundle</name>
    </types>
    <types>
        <members>*</members>
        <name>StaticResource</name>
    </types>
    <types>
        <members>PublicReports/AvailableToWorkToday</members>
        <name>Report</name>
    </types>
    <version>45.0</version>
</Package>

But I get the error: Entity of type 'Report' named 'PublicReports/AvailableToWorkToday' cannot be found

The name of the report folder is 'Public Reports' and the name of the report is 'Available To Work Today'.

Even if this works I'll only be able to retrieve the meta-data of one particular report which is of no help as I need to retrieve all the reports meta-data at once.

Any help on this would be great. Thanks

  • Could you add a screenshot with the report details (its name and API name)? It seems that you are using wrong api name of the report. Lightning report usually append some random string to api names upon first save. – Eduard May 29 at 7:54
  • @Eduard yes you were right. I got the API name incorrect. To view the API name I had to select the particular report and click the rename button after which I was able to see the API name in the pop-up window. I didn't find any other way to view the API name. Do know know of a way to get the api name of all the reports at once? – Aanchal Adhikari May 29 at 8:48
  • I just updated my answer to cover your question – Eduard May 29 at 9:24
0

It seems that you are using wrong api name of the report. Lightning report usually append some random string to api names upon first save. So make sure you provide the correct names in the manifest.

Even if this works I'll only be able to retrieve the meta-data of one particular report which is of no help as I need to retrieve all the reports meta-data at once.

As per docs - Report:

You can’t use the wildcard (*) symbol with reports in package.xml.

This means you have to list all the report you want to retrieve in your manifest. Once you do that you will be able to retrieve all the reports meta-data at once.

Do know know of a way to get the api name of all the reports at once?

Since the Report.obj is supported for queries, you can get api names of all reports just by running a simple SOQL query. While in the developer console, execute the following command in the Query Editor:

SELECT Id, Name, FolderName, DeveloperName FROM Report 

This will list all reports and their api names (DeveloperName) in your org.

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.