• JimmyNow
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

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>

This is my question. I try to retrieve a custom field from a custom object, but I cant.

 

My controller code:

 

public class viewcase {
    String Name = ApexPages.currentPage().getParameters().get('Name');
    public List<prueba__c> getData() {     
            return Database.query('select Name, Language__c, Theme__c, FTP__c from prueba__c limit 10');
    }
   
           
}

 

 

Mi page:

 

<apex:page showHeader="false" controller="viewcase" cache="false">
        <apex:stylesheet value="{!URLFOR($Resource.SiteSamples, 'estilos.css')}" />
<apex:image id="johnryanheaderimage" value="http://www.conpas.net/jr/php5MJFUrAM.jpg" style="padding:15px;"/>
            <center> <a href="newcase">New case</a> | <a href="mycases">My cases</a> | <a href="myopenedcases">My opened cases</a> </center>
        <apex:pageBlock title="My cases" mode="edit">
        <apex:dataList value="{!Data}" var="d" id="theList">

        <apex:outputText value="-{!d.ID}"/>
        <apex:outputText value="-{!d.FTP__c}"/>
        <apex:outputText value="-{!d.Name}"/>
    </apex:dataList>
    </apex:pageBlock>

</apex:page>

I see empty the custom fields, why? I try to activate all security doors, but maybe this no is the way.

 

Thanks.

  • August 19, 2011
  • Like
  • 0