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

Retrieving LWC causes import of metadata to be __c - fails when (re)deploying #1288

Closed
briank73 opened this issue Nov 22, 2021 · 4 comments
Closed
Labels
area:lwc Highlights the lwc functional area of the CLI. owned by another team The Salesforce CLI team does not own this work but will pass on the information to the correct team.

Comments

@briank73
Copy link

Summary

Having an LWC importing fields from a metadata type; when retrieving this metadata type becomes __c instead of __mdt, making the file undeployable.

Steps To Reproduce:

Having:

  • An LWC
  • A custom metadata type
  • Import metadata type in LWC, e.g.:
    • import FALC_MDT_MASTER_LABEL_FIELD from '@salesforce/schema/FinancialAccountListColumn__mdt.MasterLabel';

Steps:

  1. Deploy
    • sfdx force:source:deploy --loglevel fatal -m LightningComponentBundle:financialAccountList2
  2. Retrieve
    • sfdx force:source:retrieve --loglevel fatal -m LightningComponentBundle:financialAccountList2
    • the import now looks:
      • import FALC_MDT_MASTER_LABEL_FIELD from '@salesforce/schema/FinancialAccountListColumn__c.MasterLabel';
  3. Deploy:
    • sfdx force:source:deploy --loglevel fatal -m LightningComponentBundle:financialAccountList2
    • fails:
      Error financialAccountList2 Invalid reference FinancialAccountListColumn__c.MasterLabel of type sobjectClass in file financialAccountList2.js

Expected result

Should be able to deploy just retrieved LWC :-).
I.e. metadata type should have postfix __mdt instead of __c.

Actual result

Fails:
Error financialAccountList2 Invalid reference FinancialAccountListColumn__c.MasterLabel of type sobjectClass in file financialAccountList2.js

System Information

sfdx-cli/7.125.0 win32-x64 node-v16.13.0
(also fails for version 126 (on mac os))
(Also fails from VS Code)

Additional information

@briank73 briank73 added the investigating We're actively investigating this issue label Nov 22, 2021
@github-actions
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.

@shetzel shetzel added owned by another team The Salesforce CLI team does not own this work but will pass on the information to the correct team. and removed investigating We're actively investigating this issue labels Nov 22, 2021
@github-actions
Copy link

We have determined that the issue you reported exists in code owned by another team that uses only the official support channels. To ensure that your issue is addressed, open an official Salesforce customer support ticket with a link to this issue. We encourage anyone experiencing this issue to do the same to increase the priority. We will keep this issue open for the community to collaborate on.

@shetzel
Copy link
Contributor

shetzel commented Nov 22, 2021

Thanks for reporting. This isn't a CLI issue. It's an issue for the Lightning Web Components team. I'll let them know about it but you might want to open a case with support for that team for faster results.

@preddivari preddivari added the area:lwc Highlights the lwc functional area of the CLI. label Nov 7, 2023
@shetzel
Copy link
Contributor

shetzel commented Dec 1, 2023

I'm going to close this since it's not a CLI issue and it's not supported LWC behavior. Looks like the proper way to do this is by using getRecord. See this for more: https://salesforcediaries.com/2019/12/13/custom-metadata-in-lightning-web-component-without-apex/

@shetzel shetzel closed this as completed Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:lwc Highlights the lwc functional area of the CLI. owned by another team The Salesforce CLI team does not own this work but will pass on the information to the correct team.
Projects
None yet
Development

No branches or pull requests

3 participants