0

There is a Visualforce email template in a managed package that I would like to modify to include a locally-created Visualforce component. All aspects of the locally-created component - the component itself, and all attributes - are global (even its class and all its variables are global), so there shouldn't be any access issues.

However, there is a hard catch I'm seeing. If I reference c:MyLocalComponent in the template, there is an error upon saving the template which states: "Unknown component c:mylocalcomponent".

I'm betting the reason is because "c:" resolves to the managed package namespace, since this is in the context of a managed package template. But there is no local namespace I can explicitly reference as an alternative - this is meant to live in a normal production org which doesn't (and can't) have one. This is a huge catch, because the local namespace (or lack thereof) is normally captured by using "c:". So, it seems like a catch 22, and thus an impossible task to accomplish.

Hoping someone can prove me wrong?

Here is the managed package template throwing the error on save:

<messaging:emailTemplate subject="Please review" recipientType="User" relatedToType="ns__CustomObject__c">
    <messaging:htmlEmailBody >
        <c:MyLocalComponent recId="{!relatedTo.ns__RecordId__c}"/>
    </messaging:htmlEmailBody>
</messaging:emailTemplate>

Here is the locally-created component MyLocalComponent:

<apex:component controller="MyLocalComponent" access="global">
    <apex:attribute name="recId" description="Record ID" type="string" assignTo="{!recordId}" access="global"/>
    <apex:outputPanel>Record ID: {!recordId}</apex:outputPanel>
</apex:component>

And here is the class:

global class MyLocalComponent
{
    global MyLocalComponent(){}
    global Id recordId {get;set;}
}

1 Answer 1

1

I spoke with Salesforce support, who confirmed that indeed this isn't possible.

You must log in to answer this question.

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