DX-Code-Companion icon indicating copy to clipboard operation
DX-Code-Companion copied to clipboard

Unable to use @import with custom objects

Open kbuckles-sfdc opened this issue 5 years ago • 14 comments

With DX-Code-Companion enabled, I am unable to use @import with a custom object. I get the following error:

FIELD_INTEGRITY_EXCEPTION: Invalid reference Custom_Object__c.Field__c of type sobjectField

If I disable DX-Code-Companion, file saves just fine and I can deploy manually and LWC works fine.

Any work around to this?

kbuckles-sfdc avatar Oct 31 '19 17:10 kbuckles-sfdc

@kbuckles-sfdc Can you provide more details around here ? Please share a simple example where i can reproduce this .

Also share the api version in your metadata xml file . I fear this is salesforce has issues with tooling api.

msrivastav13 avatar Oct 31 '19 19:10 msrivastav13

I am using: <apiVersion>46.0</apiVersion>

Steps to reproduce:

  • Create a custom object with some custom fields
  • Create a new LWC
  • In your LWC .js file, try to import a custom field from your custom object: import SOME_FIELD from '@salesforce/schema/Some_Object__c.Some_Field__c';
  • Try to save your file, which then deploys the changes to your org, and you will see the error.

kbuckles-sfdc avatar Oct 31 '19 20:10 kbuckles-sfdc

@kbuckles-sfdc Sorry for the delayed response on this. This looks like an issue with the Tooling api in salesforce. I will open a case on this and keep you updated.

msrivastav13 avatar Feb 15 '20 21:02 msrivastav13

@msrivastav13 I just ran into this same error using a custom field on a standard object (Contact). Looks like ForceCode ran into this or a similar issue here.

Any plans to address this in the near future?

jprichter avatar Apr 16 '20 17:04 jprichter

@jprichter The core issue is in the tooling api of LWC. I will raise it internally at salesforce and see what can be done for this. The Salesforce LWC extension using metadata api for it and it works with it. For now only workaround is use Salesforce Official LWC Extension.

msrivastav13 avatar Apr 16 '20 17:04 msrivastav13

Thanks for clarifying. Is this Tooling API issue posted publicly anywhere like a known issue?

jprichter avatar Apr 16 '20 18:04 jprichter

Hi

I have the same problem when I am using a custom field in an standard Object such as: import QLI_SERVICE_TYPE_NAME_FIELD from "@salesforce/schema/QuoteLineItem.Service_Type__c";

Any News? Thanks

oagostinho avatar Sep 23 '20 10:09 oagostinho

Hello,

The work is logged with metadata and tooling teams and looks like it is de prioritized at this point!

It is recommended to use mdapi for now!

msrivastav13 avatar Sep 26 '20 05:09 msrivastav13

Hi

Any News about this situation?

Thanks

tielinglang avatar Feb 10 '21 12:02 tielinglang

@tielinglang It's still in the backlog! You can use the official salesforce extension to push that uses metadata API than tooling API!

msrivastav13 avatar Feb 18 '21 04:02 msrivastav13

Hello @msrivastav13 I am having this issue even using the the official Salesforce LWC extension. Do you know why it is deprioritized ? Can you please expedite it ?

image

khanaaa-mfcgd avatar Apr 22 '21 20:04 khanaaa-mfcgd

Please raise in the official repo for the extension!

Not here!

msrivastav13 avatar Apr 22 '21 20:04 msrivastav13

@msrivastav13 Where is the official repo ?

khanaaa-mfcgd avatar Apr 22 '21 20:04 khanaaa-mfcgd

https://github.com/forcedotcom/salesforcedx-vscode

msrivastav13 avatar Apr 22 '21 20:04 msrivastav13