How to retrieve namespaced metadata?

95 views
Skip to first unread message

Jeremy Johnson

unread,
Jun 1, 2023, 6:02:17 PM6/1/23
to Illuminated Cloud Q&A
How do I retrieve and deploy custom metadata type records belonging to a managed package? 

In VS Code, I can retrieve a specific cmdt record in the managed package's namespace and deploy it to another sandbox. I can do this both by including the resource in my package.xml and by executing sfdx force:source:retrieve from the terminal.

In IC2, however, retrieving metadata using the same package.xml gives me an empty metadata dialog. And executing the same sfdx force:source:retrieve command from the terminal gives me a "File not found" error.

As far as I can tell, both VS Code and IC2 are using the same org connection. Assuming user error, but I'm stumped.

Package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>ucinn_ascendv2__Gift_Processing_Display_Setting.ucinn_ascendv2__Designation_Detail_End_Date</members>
        <name>CustomMetadata</name>
    </types>
    <version>58.0</version>
</Package>


SFDX Command

sfdx force:source:retrieve --sourcepath force-app/main/default/customMetadata/ucinn_ascendv2__Gift_Processing_Display_Setting.ucinn_ascendv2__Designation_Detail_End_Date.md-meta.xml

Results
VS Code
vscode.png
IC2
ic2.png

IntelliJ IDEA 2023.1.1 (Ultimate Edition)
Build #IU-231.8770.65, built on April 27, 2023
Runtime version: 17.0.6+10-b829.9 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.3.1
Non-Bundled Plugins:
    com.jetbrains.plugins.ini4idea (231.8770.71)
    com.intellij.ideolog (203.0.30.0)
    Batch Scripts Support (1.0.13)
    CMD Support (1.0.5)
    intellij-awk (0.4.0)
    PMDPlugin (1.8.27)
    com.illuminatedcloud2.intellij (2.2.7.0)
    com.intellij.bigdatatools (231.9011.1)


Scott

unread,
Jun 2, 2023, 8:04:11 AM6/2/23
to Illuminated Cloud Q&A, Jeremy Johnson
Hi, Jeremy. I confess I'm a bit confused, particularly because, based on my understanding from what you've posted, the issue is occurring from the command-line outside of IC2. Can you confirm that the IC2 project was created as source format and not metadata format, i.e., has an sfdx-project.json file in the project root? Because otherwise, the command you're running should be doing the exact same thing. That particular command wouldn't even be using your package.xml file as "--sourcepath" should be generating its own for selective retrieval.

Let's figure out what's going on from the command-line, and then we can move up into IC2 if there's still an issue at that point.

Regards,
Scott Wells
Reply all
Reply to author
Forward
0 new messages