cli icon indicating copy to clipboard operation
cli copied to clipboard

manifest generated by sf project generate manifest --from-org retrieves unavailable metadata records

Open GuntherRoskams opened this issue 6 months ago • 8 comments

Note Before you submit your issue, make sure that:

  • You're using the latest version of Salesforce CLI => I use the docker image (salesforce/cli:latest-slim, so I assume it is the lastest version :))
  • You've searched both open and closed issues for related posts => nothing relevant found
  • You've used the doctor command to diagnose common issues.
  • You understand that GitHub Issues don't adhere to any agreement or SLA.
    • If you require immediate assistance, use official channels such as Salesforce Customer Support.

Summary

Use case: I'm creating a script to pull the complete metadata content from an org. During the tests, we are facing an error during the retrieve of the ContentAsset component. All other components went fine, except the ContentAsset.

While I generate a manifest file from a Salesforce Org (production or sandboxes), the command generates "unavailable components" . I receive a list of ContentAsset members, which are not reachable for the user.

Below the part with the members for the metadata component ContentAsset.

Afbeelding_20221025_123738 Afbeelding_20221028_081802 Afbeelding_20221103_073159 Afbeelding_20221103_073159_1 Afbeelding_20221103_073159_2 Afbeelding_20221103_073159_3 Afbeelding_20221108_130018 Afbeelding_20221108_132411 Afbeelding_20221108_135407 Afbeelding_20221118_102445 Afbeelding_20221129_121326 Afbeelding_20221130_095904 Afbeelding_20221212_081539 Afbeelding_20230104_084841 Afbeelding_20230104_132715 Afbeelding_20230104_134746 Afbeelding_20230105_090402 Afbeelding_20230105_092527 Afbeelding_20230105_093158 Afbeelding_20230105_094739 Afbeelding_20230105_122218 Afbeelding_20230105_124754 Afbeelding_20230105_135616 Afbeelding_20230106_091344 Afbeelding_20230110_080449 Afbeelding_20230110_082350 Afbeelding_20230110_094625 Afbeelding_20230112_125320 Afbeelding_20230112_131611 Afbeelding_20230124_093215 Afbeelding_20230124_123959 Afbeelding_20230124_132247 ContentAsset

If I try to retrieve the content of one of these files, I receive the error unpackaged\contentassets\Afbeelding_20230124_132247.asset-meta.xml: Expected source files for type 'ContentAsset'

Or the issue is the creation of the package.xml manifest (which don't create the files), or the problem is the gathering of the content of the ContentAsset file.

If I remove the ContentAsset part in the XML and runs the command to retrieve the source code for the manifest, the script runs without any error.

Steps To Reproduce

I cannot provide you a repo, due to the fact these are customer orgs, and I'm facing the issue on several orgs (especially orgs with ContentAsset records)

After the generation of the manifest file, I want to retrieve the content of each member, with the command

sf project retrieve start -m ContentAsset:Afbeelding_20230124_132247 -o myCustomerOrg -c

which should result in a file in the sf folder structure. Unfortunately, the command returns an error and the request failed unpackaged\contentassets\Afbeelding_20230124_132247.asset-meta.xml: Expected source files for type 'ContentAsset'

Further analys gives me that some of the ContentAsset files are Private, but also content assests, created in a public library returns the same error. And I'm logging in with a System Admin user, without restrictions (I can see the file in the Salesforce screens) Some of the ContentAsset can be loaded. Most of the time these files are created and used in Lighting Applications. For some reason, older files are not supported as a ContentAsset file, or could not loaded as an asset file (it looks like the file is missing somewhere, or not linked)

Steps to reproduce:

  • have an org with old files, which are available via a SOQL query (I queried the records and received the results, so I do have read access on these files with the user)
  • Create a manifest file with the command
sf project generate manifest --from-org your-org-alias -d manifest
  • Open the manifest file and check if you 'll find some ContentAsset files
  • Try to retrieve one of the ContentAsset files with the command
sf project retrieve start -m ContentAsset:Afbeelding_20230124_132247 -o your-org-alias
  • Retrieve the Error (MetadataTransferError): Metadata API request failed: unpackaged\contentassets\Afbeelding_20230124_132247.asset-meta.xml: Expected source files for type 'ContentAsset'

Expected result

I should receive the asset file in the Salesforce SF structure, or the file could not be found. no exception at all

Actual result

an error, which blocks my whole script to download the metadata from an org

System Information

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.55.6",
  "nodeVersion": "node-v20.16.0",
  "osVersion": "Windows_NT 10.0.19045",
  "rootPath": "C:\\Users\\roskagu\\AppData\\Local\\sf\\client\\2.55.6-648ad30",
  "shell": "powershell",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.0 (core)",
    "@oclif/plugin-commands 4.0.11 (core)",
    "@oclif/plugin-help 6.2.8 (core)",
    "@oclif/plugin-not-found 3.2.16 (core)",
    "@oclif/plugin-plugins 5.4.4 (core)",
    "@oclif/plugin-search 1.2.5 (core)",
    "@oclif/plugin-update 4.5.3 (core)",
    "@oclif/plugin-version 2.2.10 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.11 (core)",
    "@oclif/plugin-which 3.2.10 (core)",
    "@salesforce/cli 2.55.6 (core)",
    "apex 3.3.4 (core)",
    "auth 3.6.47 (core)",
    "data 3.6.0 (core)",
    "deploy-retrieve 3.9.27 (core)",
    "info 3.3.28 (core)",
    "limits 3.3.24 (core)",
    "marketplace 1.2.22 (core)",
    "org 4.4.6 (core)",
    "packaging 2.7.4 (user) published 30 days ago (Tue Jul 23 2024) (latest is 2.8.0)",
    "schema 3.3.22 (core)",
    "settings 2.3.11 (core)",
    "sobject 1.4.28 (core)",
    "source 3.5.12 (core)",
    "telemetry 3.6.6 (core)",
    "templates 56.3.11 (core)",
    "trust 3.7.22 (core)",
    "user 3.5.23 (core)"
  ]
}

Additional information

GuntherRoskams avatar Aug 22 '24 15:08 GuntherRoskams