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
JimmyNowJimmyNow 

Having trouble with returning the value of an "Account" custom field

Hello, I am pretty new to VisualForce so please bear with me. 

 

I am trying to access the value of a custom account field and for some reason it will not display. In the same page when I access normal or standard account fields such as name, phone, fax, ect., they display no problem. For some reason it just will not grab the values of the custom account fields that I have created in the "Account" object.

 

Here is the code for the page. I have a custom controller as well.Like I said, all the standard account fields are working perfectly. But for some reason when I try to display any custom fields, for instance Account_Number__c, it will not work.

 

Any help would be greatly appreciated.

 

<apex:pageBlock mode="edit" id="results">
 
        <apex:pageBlockTable value="{!account}" var="a">
 
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputText value="{!a.name}"/>
            </apex:column>
 
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Account Number" action="{!toggleSort}" rerender="results,debug" immediate="true">
                        <apex:param name="sortField" value="AccountNumber" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputText value="{!a.Account_Number__c}"/>
            </apex:column>
 
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="January" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="a.Current__c" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputText value="{!a.Current__c}"/>
            </apex:column>
 
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="February" action="{!toggleSort}" rerender="results,debug" >
                       <apex:param name="sortField" value="a.February__C" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputText value="{!a.Phone}"/>
            </apex:column>
             <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="march" action="{!toggleSort}" rerender="results,debug" >
                       <apex:param name="sortField" value="a.March__C" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputText value="{!a.Fax}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="April" action="{!toggleSort}" rerender="results,debug" >
                       <apex:param name="sortField" value="a.April__C" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputText value="{!a.April__c}"/>
            </apex:column>

JimRaeJimRae

What kind of controller are you using (standard, custom, extension)?  Are you getting an error, or does the data just not appear?  Do you know if the record has the field you are looking for?  is it the same user accessing the data (so the same permissions)?