TransWikia.com

Visualforce Component wrapped in a Managed Package Visualforce Component throws the error: Unknown component c:mycomponent

Salesforce Asked by Nick Cook on October 4, 2021

I have a managed package installed in a subscriber org. The managed package contains a Visualforce Component that I want to use in subscriber org.

My goal is to use a subscriber org VF component within a managed package VF component on a subscriber org page.

e.g.
enter image description here

Subscriber org page

<apex:page standardController="myNamespace__myObject__c">

    <myNamespace:myManagedPackageComponent>
        
        <c:mycomponent recordId="{!myNamespace__myObject__c.Id}" />

    </myNamespace:myManagedPackageComponent>
    
</apex:page>

The page saves without error.

When I navigate to this page, i get an error:

Unknown component c:mycomponent

I’ve tried with access="global" on both mycomponent and it’s attributes, but still get this error.

I’ve confirmed mycomponent works by adding it to the page outside of the myNamspace:myManagedPackageComponent component.

Is there any way to include subscriber org VF components within a managed package VF component?

A similar scenario might be when using Visualstrap on a page, and wanting to include a VF component within the visualstrap component.

One Answer

I think it would be possible, as long as thhe managed package component is implementing somewhere inside the apex:componentBody/ tag. Here is an example:

<!-- Page: --> 
<apex:page>
    <apex:outputText value="(page) This is before the custom component"/><br/>
    <c:bodyExample>
        <apex:outputText value="(page) This is between the custom component" /> <br/>
    </c:bodyExample>
    <apex:outputText value="(page) This is after the custom component"/><br/>
</apex:page>

<!-- Component: bodyExample -->
<apex:component>
    <apex:outputText value="First custom component output" /> <br/>
    <apex:componentBody />
    <apex:outputText value="Second custom component output" /><br/>
</apex:component>

More details on the below documentation link: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_componentBody.htm

I would say that if the component is not implementing that and of course the package its not of your own (something you can not modify) this is not an achievable goal.

Answered by Gabriel Serrano Salas on October 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP