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
thsfthsf 

Standard List Controller + Custom Lead Field + Managed Package...:(

I am developing a managed package and trying to create a Visualforce Page to mass update Leads.  Using some samples I found online I created a test page as follows in my development instance:

 

<apex:page standardController="Lead" recordSetVar="Leads">
    <apex:form >
        <apex:pageBlock mode="edit" title="Mass Update Lead Test">
            <apex:pageMessages />
            <apex:pageBlockSection columns="1">
                <apex:inputField value="{!Lead.FirstName}" required="true"/>
                <apex:inputField value="{!Lead.LastName}" required="true"/>
                <apex:inputField value="{!Lead.CustomField1__c}" required="true"/>
                <apex:inputField value="{!Lead.CustomField2__c}" required="true"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}" />
                <apex:commandButton value="Cancel" action="{!cancel}" />
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

This works fine in my developer instance.  However, when I upload the managed package and then install it into another instance the custom fields do not show up on the page while the standard fields do.  Has anybody else experienced this and know of a workaround?

 

As an FYI, here is what the uploaded page looks like (notice the namespace has been added to the custom fields).

 

<apex:page standardController="Lead" recordSetVar="Leads">
    <apex:form >
        <apex:pageBlock mode="edit" title="Mass Update Lead Test">
            <apex:pageMessages />
            <apex:pageBlockSection columns="1">
                <apex:inputField value="{!Lead.FirstName}" required="true"/>
                <apex:inputField value="{!Lead.LastName}" required="true"/>
                <apex:inputField value="{!Lead.xxxx__CustomField1__c}" required="true"/>
                <apex:inputField value="{!Lead.xxxx__CustomField2__c}" required="true"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}" />
                <apex:commandButton value="Cancel" action="{!cancel}" />
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
thsfthsf

Thanks for your suggestion Bob.  I was installing the packing into a Professional Edition test environment, so field security wasn't the issue.

 

Today when I logged in, I added the fields to the Lead Page Layout, the the fields magically showed up on my custom page.  I have seen this issue before I believe it is a caching issue w/ the platform.  The issue being -> fields that are installed from a Managed Package are not always immediately available from the API.  You can force a refresh by adding one of the new fields to a Page Layout.  This is more of a hunch that anything, but it has worked for me in the past and my code is working now.

 

Thanks again.

 

All Answers

bob_buzzardbob_buzzard

Have you checked the field level security for the user that is viewing the page via the managed package install?  

thsfthsf

Thanks for your suggestion Bob.  I was installing the packing into a Professional Edition test environment, so field security wasn't the issue.

 

Today when I logged in, I added the fields to the Lead Page Layout, the the fields magically showed up on my custom page.  I have seen this issue before I believe it is a caching issue w/ the platform.  The issue being -> fields that are installed from a Managed Package are not always immediately available from the API.  You can force a refresh by adding one of the new fields to a Page Layout.  This is more of a hunch that anything, but it has worked for me in the past and my code is working now.

 

Thanks again.

 

This was selected as the best answer