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

Error when using <objects><object>SOBJECT_NAME</object></objects> inside a <targetConfig> #446

Closed
AllanOricil opened this issue Aug 18, 2021 · 2 comments
Labels
duplicate This issue or pull request already exists lwc Affects the LWC language serevr

Comments

@AllanOricil
Copy link

Summary

I just configured a LWC to work with an Object and I got this error. The configuration is fine and it is deployable to a Salesforce org. It is just the vscode extension that complains about it.

image

Below you can see the valid lwc xml config

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <property label="Height" name="height" type="String" default="500px" description="Adjust this value to change the Height. If you clean this value, it defaults to 100%."/>
            <property label="Width" name="width" type="String" default="" description="Adjust this value to change the component's Width. If you clean this value, it defaults to 100%."/>
            <objects>
                <object>WorkOrder</object>
            </objects>
        </targetConfig>
    </targetConfigs>
    
</LightningComponentBundle>

This is the error message when hovering over the indicated error:

Invalid element name:
 - objects

One of the following is expected:
 - property
 - propertyType
 - supportedFormFactors

Error indicated by:
 {http://soap.sforce.com/2006/04/metadata}
with code:xml(cvc-complex-type.2.4.a)
Limits the component to a set of one or more objects. If you don’t use this tag set, the component supports all supported objects. This tag set works only inside a parent targetConfig that’s configured for lightning__RecordPage. Specify the objects tag set only once inside a targetConfig set. Supports the object subtag

Steps To Reproduce:

  1. Configure a "targetConfig" with an "Object", like the one below:
<targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <property label="Height" name="height" type="String" default="500px" description="Adjust this value to change the Height. If you clean this value, it defaults to 100%."/>
            <property label="Width" name="width" type="String" default="" description="Adjust this value to change the component's Width. If you clean this value, it defaults to 100%."/>
            <objects>
                <object>WorkOrder</object>
            </objects>
        </targetConfig>
    </targetConfigs>

Expected result

This error message should not appear

Actual result

There is a wrong error message appearing when configuring a LWC to work with an Object.

Additional information

image

SFDX CLI Version: sfdx-cli/7.94.3-a4e7c7955b win32-x64 node-v14.15.4

OS and version: windows 10

@randi274
Copy link
Contributor

randi274 commented Mar 7, 2022

Screen Shot 2022-03-07 at 5 19 53 PM

Still seeing this as of March 2022, albeit slightly improved? Will log this as a bug for us, thanks!

@jeffb-sfdc
Copy link
Contributor

This is a duplicate of forcedotcom/salesforcedx-vscode#3503

@jeffb-sfdc jeffb-sfdc added the duplicate This issue or pull request already exists label Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists lwc Affects the LWC language serevr
Projects
None yet
Development

No branches or pull requests

3 participants