0

This was asked before in 2015 (Why won't my component show up in the layout editor) but I didn't understand the answer and it is now 8 years later so I thought it might be worth asking again.

I created a LWC that calls some apex code directly (not @wire) and deployed the whole component and the apex to be called. The component includes a js, html, and js-meta.xml all with the same name. My xml has isExposed set to true and sets various targets as seen below

<?xml version="1.0" encoding="UTF-8" ?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>57.0</apiVersion>
    <description>gets call recordings from AWS S3</description>
    <isExposed>true</isExposed>
    <masterLabel>getCallRecording</masterLabel>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>

When I log into salesforce (using the same account I deployed with in case that matters) and go to setup > Lightning Components, I see my lwc listed with 'LWC' as the type. However when I to the the Lightning App Builder, I do not see it under Custom. Or anywhere else for that matter. Similarly, when I go to Dev Console > File > Open, I don't find it under page components or anywhere else.

What am I missing?

1 Answer 1

0

Try adding this part in your xml file and deploy it again.

<targetConfigs>
    <targetConfig targets="lightning__RecordPage">
        <objects>
            <object>Contact</object>
        </objects> 
    </targetConfig>
</targetConfigs>

So that your file would look like this:

<?xml version="1.0" encoding="UTF-8" ?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>57.0</apiVersion>
    <description>gets call recordings from AWS S3</description>
    <isExposed>true</isExposed>
    <masterLabel>getCallRecording</masterLabel>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <objects>
                <object>Contact</object>
            </objects> 
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>

Side note: Add the API name of the object which you use, instead of Contact.

2
  • Thanks for your suggestion! I tried doing this exactly as written, and then I tried adding it to the contact page in the app builder and it still doesn't show up. I created an aura component and it does show up, but I would really rather use a LWC if I can. Any other thoughts? Jun 1, 2023 at 19:34
  • I created a brand new sandbox to myself and created a new LWC with the same XML file in my IDE. When I deploy it, I am able to see it in custom section of Lightning App Builder. Are you sure you are deploying it to your org? Right click on your LWC folder in your IDE and select SFDX: Deploy Source to Org. ~@user1887085
    – Alp
    Jun 3, 2023 at 2:55

You must log in to answer this question.

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