• elessenger_ct
  • 5 Points
  • Member since 2010

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 2

We are building a product that includes a Custom VisualForce Component called "CustomSettingAddress" that renders a form on the page using data retrieved from the database via custom SOQL, and then saves data back to Salesforce. This works perfectly in development, and when included in pages that are deployed as part of the G2 package.


However, when we attempt to embed this managed component in an unmanaged VisualForce page (e.g. in our customer's org) we are running into security issues. The component itself is global, and we would prefer not to make the controller global, but if we don't then the customer receives a message "the managed class g2.CustomSettingAddressCtl is not accessible". To resolve the problem, we make the controller and all methods global. This allows us to render the form properly, including data from accessor methods that reference other public (but not global) managed classes from within the controller. However, when we attempt to post back to the controller (using a CommandButton) we receive an "insufficient permissions" error.
Any ideas or suggestions on best practices for writing controllers for global components in managed packages? Do we need to make all classes referenced by the controller global as well?

We're using the new Apex Install Script feature and we're getting an error on package install.


When the attempt to install the package fails we receive the following email from Salesforce:


The package installation failed. Please provide the following information to the publisher:


Organization Name: [org name] Organization ID: [org id]

Package: [package name]

Version: 6.2

Error Message: The post install script failed.


Thank You,



That doesn't really give us much to go on.  Does anyone know of a way to get more details about the failure?  Ideally we want to know what line number of the install handler or the exception that caused the problem.

  • August 03, 2012
  • Like
  • 0

If I install my managed beta package into a new developer org the installation works fine.


If I install, then uninstall and re-install the installation still works fine.


But if I install, use "Manage" to create an org instance of a custom setting object, then uninstall and re-install the re-install fails with errors like these:


Apex Classes(01pA0000000i0ux) benefitclaimedactionstest.test()
System.DmlException: Insert failed. First exception on row 0;
cvc.BenefitTrigger: execution of BeforeInsert

caused by: System.DmlException: Upsert failed. First exception on row 0;
first error: DUPLICATE_VALUE, duplicate value found:
SetupOwnerId duplicates value on record with id: 00DA0000000Y0TO: []


It appears the unit tests run as part of the install process are failing because of this underlying code (in this one case only):



public class CustomSettings {
    public static DateConversionFactors__c getDateConversionFactors() {
        if (DateConversionFactors__c.getOrgDefaults() == null) {
            insert new DateConversionFactors__c(SetupOwnerId = UserInfo.getOrganizationId());
        return DateConversionFactors__c.getOrgDefaults();


My best guess is that the uninstall is not cleaning up the data created when "Manage" was used completely and so the SetupOwnerId inserted here is being seen as a duplicate.


Does anyone have any experience of this problem or insight into how to avoid it?