function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Simon GoodyearSimon Goodyear 

Custom VisualForce Components in Managed Packages: assignTo problems


I have been experencing a strange issue when I install a managed package (yes, I know, dirty words) that contains a csutom visualforce component. The installation will fail with a cryptic error message such as:

 

Your requested install failed. Please try this again.

None of the data or setup information in your salesforce.com organization should have been affected by this error.

If this error persists, contact salesforce.com Support through your normal channels and reference number: 1090666547-3867 (-1010003720)  

 

I have whittled the package down to the bare minimum require to recreate the error however I have been unable to find a solution to the problem.. this is where I hope you folks can all come to my rescue and point out the silly mistake that I have made!

 

I have a feeling that I've got some permissions, access level or namespace issue somewhere.

 

So, I have the following code...

 

A simple custom component:

 

<apex:component allowDML="true" id="simpleCon" controller="simpleController" access="global">
    <apex:attribute name="object" description="The object to associate with" type="sObject" assignTo="{!contextObject}" access="global"/> 
    
 This is a component

</apex:component>

 

 Backed by a simple Apex controller:

 

global with sharing class simpleController{

    global sObject contextObject {get; set;}
} 

 

I then have the following VisualForce page:

 

<apex:page standardController="Account" extensions="PageExtension" >
 A Page
 <c:SimpleExample object="{!currentObject}" />
</apex:page>

 

Which in turn is backed by the Controller Extension:

 

global with sharing class PageExtension {
    
    global sObject currentObject {get; set;}
    
    global PageExtension(ApexPages.Standardcontroller controller){
        currentObject = controller.getRecord();
    }
 
}

 

I also have all of the necessary test classes in place for the two apex classes.

 

When I open the VF page in the dev org everything works as you would expect.

 

I then package it up as a fully managed package which works without any problems.

 

The next step is to install this package into another org. At this point as I click Install I get the error message above.

 

I have played around with this and, if I remember correctly, the problem goes away if I remove the assignTo attribute from the apex:attribute on the component. However this sin't much use to me as I really could do with the reference to the object.

 

Does anyone have any thoughts about this? Am I missing something blindingly obvious? All help is greatly appreciated.

 

aballardaballard

Looks like it ought to work.   You may need to open a support  case.

Simon GoodyearSimon Goodyear

Yeah, I thought it should work - in fact it does work so long as it's not in a managed package.

 

I have a case open I was just exploring all channels to see if anyone else had come across this before.

 

Thanks