Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with "ReportFolder" resource path in sf org list metadata-types command #3190

Closed
Alfystar opened this issue Jan 22, 2025 · 8 comments
Closed
Labels
more information required Issue requires more information or a response from the customer validated Version information for this issue has been validated

Comments

@Alfystar
Copy link

Summary

I am encountering an issue while performing a deployment log analysis using the sf project deploy report command. The command used is as follows:

sf project deploy report --target-org 'PROD_DEVOPS' --job-id 0Afcl000000JeBRCA0 --wait 12000

One of the entries in the resulting JSON is:

"result": {
   "details": {
       "componentSuccess": [
           {
               "changed": true,
               "componentType": "ReportFolder",
               "created": true,
               "createdDate": "2025-01-21T15:18:51.000Z",
               "deleted": false,
               "fileName": "zip/reports/Gestionedelcredito-meta.xml",
               "fullName": "Gestionedelcredito",
               "id": "00lcl0000000hszAAA",
               "success": true
           }
       ]
   }
}

To obtain the actual path of the resource and perform git analysis, I rely on the output of the command:

sf org list metadata-types --target-org 'PROD_DEVOPS' --json > prod_devops_metaRule_enelx.json

Where I search, based on the "componentType" of the report, for the rules of that metadata.

Issue:

I discovered that the "ReportFolder" resource, which my developers have placed in the main/default/reports folder, does not exist in this file. However, from the result of the sf command, the deployment was successful and it is indeed in that directory.

Additionally, in source format, the file seems to be named: Gestionedelcredito.reportFolder-meta.xml.

Steps To Reproduce

  1. Run the sf project deploy report command with the specified parameters.
  2. Check the resulting JSON output.
  3. Run the sf org list metadata-types command and verify the absence of the "ReportFolder" resource.

Expected result

The "ReportFolder" resource should be present in the JSON file generated by the sf org list metadata-types command.

Actual result

The "ReportFolder" resource is not present in the generated JSON file, despite the deployment being successful.

Thank you very much for your attention and cooperation.

System Information

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.72.21",
  "nodeVersion": "node-v23.4.0",
  "osVersion": "Darwin 24.2.0",
  "rootPath": "/opt/homebrew/lib/node_modules/@salesforce/cli",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.16 (core)",
    "@oclif/plugin-commands 4.1.15 (core)",
    "@oclif/plugin-help 6.2.20 (core)",
    "@oclif/plugin-not-found 3.2.33 (core)",
    "@oclif/plugin-plugins 5.4.24 (core)",
    "@oclif/plugin-search 1.2.17 (core)",
    "@oclif/plugin-update 4.6.21 (core)",
    "@oclif/plugin-version 2.2.19 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.29 (core)",
    "@oclif/plugin-which 3.2.23 (core)",
    "@salesforce/cli 2.72.21 (core)",
    "apex 3.6.8 (core)",
    "api 1.3.2 (core)",
    "auth 3.6.85 (core)",
    "data 4.0.1 (core)",
    "deploy-retrieve 3.17.0 (core)",
    "info 3.4.30 (core)",
    "limits 3.3.43 (core)",
    "marketplace 1.3.7 (core)",
    "org 5.2.16 (core)",
    "packaging 2.9.10 (core)",
    "schema 3.3.45 (core)",
    "settings 2.4.9 (core)",
    "sobject 1.4.48 (core)",
    "telemetry 3.6.29 (core)",
    "templates 56.3.34 (core)",
    "trust 3.7.53 (core)",
    "user 3.6.5 (core)",
    "sfdx-plugin-source-read 1.4.1 (user) published 32 days ago (Fri Dec 20 2024)"
  ]
}
@Alfystar Alfystar added the investigating We're actively investigating this issue label Jan 22, 2025
@github-actions github-actions bot added the validated Version information for this issue has been validated label Jan 22, 2025
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@cristiand391
Copy link
Member

I can repro this issue, the API that org list metadata-types uses seems to skip ReportFolder:
https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_describe.htm

sf org list metadata can get it info about the report folder, does that one works for you?

➜  dreamhouse-lwc git:(main) ✗ sf org list metadata --output-file reportFolder.json --metadata-type ReportFolder && jq . reportFolder.json
Wrote result file to reportFolder.json.
[
  {
    "createdById": "005DE00000LoKp0YAF",
    "createdByName": "User User",
    "createdDate": "2025-01-23T14:15:27.000Z",
    "fileName": "reports/Lala",
    "fullName": "Lala",
    "id": "00lDE000002dILmYAM",
    "lastModifiedById": "005DE00000LoKp0YAF",
    "lastModifiedByName": "User User",
    "lastModifiedDate": "2025-01-23T14:15:27.000Z",
    "manageableState": "unmanaged",
    "type": "ReportFolder"
  },

@cristiand391 cristiand391 added more information required Issue requires more information or a response from the customer and removed investigating We're actively investigating this issue labels Jan 23, 2025
@Alfystar
Copy link
Author

Hi @cristiand391

Yes the command you use, in the org of the issue work:

18:43:34 ~/Documents/01_repo/xcustomer-global  (MASTER_EUTEMP_20250117)
└─▶ $ sf org list metadata --output-file reportFolder.json --metadata-type ReportFolder && jq . reportFolder.json

And this is some output line:

[
  {
    "createdById": "----",
    "createdByName": "Rosa ---",
    "createdDate": "----",
    "fileName": "reports/Leroy_Merlin",
    "fullName": "Leroy_Merlin",
    "id": "---",
    "lastModifiedById": "---",
    "lastModifiedByName": "----",
    "lastModifiedDate": "----",
    "manageableState": "unmanaged",
    "type": "ReportFolder"
  },
  {
    "createdById": "0051i000002pKkgAAE",
    "createdByName": "DAVID ---",
    "createdDate": "----",
    "fileName": "reports/X7_SGE_CM_AE_DE",
    "fullName": "X7_SGE_CM_AE_DE",
    "id": "----",
    "lastModifiedById": "0051i000002pKkgAAE",
    "lastModifiedByName": "DAVID ----",
    "lastModifiedDate": "----",
    "manageableState": "unmanaged",
    "type": "ReportFolder"
  },
...

The problem is with metadata-types, as you say

You think can be fix?

@cristiand391
Copy link
Member

You think can be fix?

@Alfystar I couldn't find an internal bug for the the API owners about this so I'll ask them if this is the expected behavior or a bug and get back to you.

@cristiand391
Copy link
Member

This is the expected behavior, see:

ReportFolder isn’t returned as a type in describeMetadata(). Report is returned from describeMetadata() with an associated attribute of inFolder set to true. If that attribute is set to true, you can construct the type by using the component name with the word Folder, such as ReportFolder.

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

@Alfystar
Copy link
Author

Alfystar commented Jan 27, 2025

Hi @cristiand391!

I want to thank you for your answer, it enlightened me about the use of the "inFolder" option.
Now I understand that it is true for those metadata that travel with a pair of "-meta.xml" and a directory in the "MetadataFormat" format.

In the past I was misled by staticresources, but now that I have more knowledge, I understand that it is because staticresources, in MetadataFormat format are a pair of "-meta.xml" and a compressed file, and only in the "SourceFormat" this compressed file can become a directory.

May I ask you, before closing the case, to also explain the metaFile parameter that I obviously did not fully understand.

I report what I understood from the documentation on the command response sf org list metadata-types

{
"directoryName": "staticresources", # Directory Name
"suffix": "resource",               # In "metadata-format" is the suffix of the resource
"xmlName": "StaticResource",        # Tag name inside to use inside package.xml
"childXmlNames": []                 # List of child sub-components for this component
"metaFile": true,                   # True if in "metadata-format" ???
"inFolder": false,                  #/ True if in "metadata-format" there are one folder, and one '-meta.xml' with the syntax: '<folderName>.<suffix>Folder-meta.xml' 
                                    #\    Inside the '-meta.xml' the xmlName will be: '<xmlName>Folder'
}

Finally, after reading the documentation you linked me, I would like to know if there is an sf-cli equivalent to call ListMetadataQuery and get the report names starting from the directory. So I can use that data to create the package.xml targeted to only the resources I want

A thousand thanks ! 😊

@cristiand391
Copy link
Member

May I ask you, before closing the case, to also explain the metaFile parameter that I obviously did not fully understand.

yep, here's the doc for the describeMetadata response:

metaFile boolean Indicates whether the component requires an accompanying metadata file. For example, documents, classes, and s-controls are components that require an additional metadata file.

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

Finally, after reading the documentation you linked me, I would like to know if there is an sf-cli equivalent to call ListMetadataQuery and get the report names starting from the directory. So I can use that data to create the package.xml targeted to only the resources I want

sf org list metadata --metadata-type <metadata> does exactly that (listMetadata call where --metadata-type is set as the ListMetadataQuery query).

@Alfystar
Copy link
Author

Thanks @cristiand391 for all this informations!
Your posts answer to a lot of my questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more information required Issue requires more information or a response from the customer validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

2 participants