1

When I am executing sfdx command to generate custom metadata from custom settings object, I receive error No sObject with name My_Existing_Object__c found in the org. However object/custom setting is present in the org and code directory as well. I am using below command as per SFDX docs: sfdx force:cmdt:generate --devname MyCmdt --sobjectname My_Existing_Object__c

Update: Even sfdx force:cmdt:record:insert doesnt seem to work. It is not able to pick the field given in csv which is present in code base :(

Thanks in advance!

6
  • Custom metadata objects end with __mdt and not __c like custom objects and custom metadata. I would check the syntax, because that could be confusing the CLI into searching for an object called My_Existing_Object__c and not a custom metadata type.
    – nbrown
    Commented Aug 25, 2021 at 15:27
  • @nbrown That's not the problem. I checked the docs :D
    – sfdcfox
    Commented Aug 25, 2021 at 15:28
  • Does your org have a namespace (try MyNS__My_Existing_Object__c)? Are you using the correct org (check force:config:list)?
    – sfdcfox
    Commented Aug 25, 2021 at 15:28
  • Yes my org has namespace and I have tried with prefixing the namespace as well. But it doesn't work. I am using the correct org, I have verified that many times :)
    – Amit
    Commented Aug 25, 2021 at 15:30
  • 2
    Okay, so I tested this out in my org... Same result. I'm not sure what's going on. I'll see if anyone has an idea.
    – sfdcfox
    Commented Aug 25, 2021 at 15:53

1 Answer 1

0
  1. you need to do this in a sfdx project
  2. your custom object needs to be pulled locally into that project
  3. you get a weird locking error
  4. but it does generate the mdt

Results with weird error

5
  • That was a quick test object I threw in, there's no records, but schema was created - remember it only created it locally so you now need to push it to your org
    – Rob Cowell
    Commented Aug 25, 2021 at 16:02
  • Ok, scratch that, it creates it empty. Adding the --loglevel DEBUG flag gives me ERROR running force:cmdt:generate: Failed to generate custom metadata. Reason: arr.map is not a function.
    – Rob Cowell
    Commented Aug 25, 2021 at 16:08
  • I assume you have your Test__c object in the same directory as well - force-app/main/default/objects/
    – Amit
    Commented Aug 25, 2021 at 16:25
  • Yes, standard project structure, pulling metadata from the org. the "arr.map is not a function" does look like a JS/Node bug, i.e., the CLI not your use of it or your project
    – Rob Cowell
    Commented Aug 25, 2021 at 16:49
  • Tried in both Win cmdline and WSL, same issue - also worth noting that it creates things in force-app/main/default/customMetadata (note the capital M) by default unless you specify a path and you need to run the command from the root of your project. JS error message notwithstanding
    – Rob Cowell
    Commented Aug 25, 2021 at 17:00

You must log in to answer this question.

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