0

I want to expose an internal record page-based LWC on a record page in a customer community. This is the current meta file:

    <?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>47.0</apiVersion>
    <isExposed>true</isExposed>
    <masterLabel>Load Tracking Log</masterLabel>
    <targets>
        <target>lightning__RecordPage</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <objects>
                <object>Load__c</object>
            </objects>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>

How do I do this? It is specific to the Load__c object so I assume I would do something like this:

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>47.0</apiVersion>
    <isExposed>true</isExposed>
    <masterLabel>Load Tracking Log</masterLabel>
    <targets>
        <target>lightning__RecordPage</target>
        <target>lightningCommunity__Page</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordPage">
            <objects>
                <object>Load__c</object>
            </objects>
        </targetConfig>
        <targetConfig targets="lightningCommunity__Page">
            <objects>
                <object>Load__c</object>
            </objects>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>

However this creates an error on save:

The 'objects' tag isn't supported for lightningCommunity__Page

How do you expose an object-specific LWC on a customer community correctly?

Thanks.

1
  • Digital Experiences do not actually have object-specific pages so you cannot restrict the context to a specific object.
    – Phil W
    Commented Sep 10, 2021 at 6:47

1 Answer 1

1

Digital Experiences do not have the concept of an object specific page. All behaviours are driven by the configuration of the page URL and the component properties. Take a look, for example, at the generic object page that expects two path step "parameters" (these are given binding names using the colon prefix) that define the object API name and the record ID which are passed (via the binding names) into the standard component for presenting record details**.

As such while standard pages allow the LWC to be restricted to a page for a given type of object, you simply do not have that ability in Digital Experiences.

You need to make the LWC behave nicely (e.g. show an error message) when the object type is not appropriate.

**: Note that the bindings are passed in expressions, handled by the infrastructure, so the component sees the actual values, not the expressions. The same approach works for query parameters for the page, though the page URL doesn't then need a binding to make it work since the binding name is the query parameter name.

You must log in to answer this question.

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