+ Start a Discussion
Ravi_SFDCRavi_SFDC 

Error: Unknown property 'AccountStandardController.accGroup'

Error: Unknown property 'AccountStandardController.accGroup'

My VF Page
<apex:page standardController="Account" extensions="AccountSearchUI" sidebar="false">
<head>
<title>Account Search UI</title>
<style type="text/css">
body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px;}

a:link    {color:blue; background-color:transparent; text-decoration:none}
a:visited {color:blue; background-color:transparent; text-decoration:none}
a:hover   {color:blue; background-color:transparent; text-decoration:underline}
a:active  {color:blue; background-color:transparent; text-decoration:underline}

<!--.tablemain tr:nth-child(odd){ background: #E6E6E6;}
.tablemain tr:nth-child(even){ background: #FFFFFF;}
.tablemain {border:#E6E6E6 1px thin;}-->

.tablemain tr:nth-child(odd){ background: #F0F0F0;}
.tablemain tr:nth-child(even){ background: #FFFFFF;}
.tablemain {border:#F0F0F0 1px thin;}


.headingmain {align=left; valign=top; font-family:Calibri; font-weight:bold; font-size:20px; bgcolor=#FFFFFF;}
.headingsub1{align=left; font-family:Calibri; font-size:13px; font-weight:bold; bgcolor=#FFFFFF;}
.headingsub2{font-family:Calibri; font-size:13px;}

.headingpicklistlabel{align=left; font-family:Calibri; font-size:14px; font-weight:bold; bgcolor=#FFFFFF;}

</style>
</head>

<body>
<apex:form >
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
    <tr>
    <td bgcolor="#FFFFFF" valign="top">
        <table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
            <tr><td height="1"></td></tr>
            <tr><td height="30" class="headingmain">&nbsp;Account Search UI</td></tr>
            <tr>
                <td height="15" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="11%">&nbsp;</td>
                    <td height="25" width="6%" class="headingpicklistlabel">Group</td>
                    <td width="1%">&nbsp;</td>
                    <td width="81%">
                        <apex:selectList multiselect="false" size="1">
                            <apex:selectOptions value="{!accGroup}"></apex:selectOptions>
                        </apex:selectList>
                    </td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td height="25" width="8%" class="headingpicklistlabel">Vertical</td>
                    <td>&nbsp;</td>
                    <td>Vertical</td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td height="25" width="8%" class="headingpicklistlabel">Type</td>
                    <td>&nbsp;</td>
                    <td>Type</td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td height="25" width="8%" class="headingpicklistlabel">Ranking</td>
                    <td>&nbsp;</td>
                    <td>Ranking</td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td height="25" width="8%" class="headingpicklistlabel">Accounts</td>
                    <td>&nbsp;</td>
                    <td>Accounts</td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                </table></td>
                <td height="5" bgcolor="#FFFFFF">&nbsp;</td>
                <td height="5" bgcolor="#FFFFFF">&nbsp;</td>
            </tr>
            <tr>
                <td align="center">
                  <table width="100%" border="0" cellspacing="0" cellpadding="1" class="tablemain">
                    <tr>
                      <td width="10%" height="23" class="headingsub1">View Dashboard</td>
                      <td width="10%" height="23" class="headingsub1">Group Org Acc</td>
                      <td width="10%" height="23" class="headingsub1">Vertical</td>
                      <td width="10%" height="23" class="headingsub1">Account Name</td>
                      <td width="10%" height="23" class="headingsub1">Type</td>
                      <!--<td width="10%" height="23" class="headingsub1">Owner Last Name</td>-->
                      <td width="10%" height="23" class="headingsub1">Client Rank</td>
                      <td width="10%" height="23" class="headingsub1">Account Plan</td>
                      <td width="10%" height="23" class="headingsub1">Last Modified</td>
                      <td width="10%" height="23" class="headingsub1">View Latest PDF</td>
                      <td width="10%" height="23" class="headingsub1">PDF Upload Date</td>
                    </tr>
                    <apex:repeat value="{!accPList}" var="cp">
                    <tr>
                        <td height="23" class="headingsub2"><apex:outputField value="{!cp.Group_Org__c}"/></td>
                        <td height="23" class="headingsub2"><apex:outputField value="{!cp.Group_Org__c}"/></td>
                        <td height="23" class="headingsub2"><apex:outputField value="{!cp.Vertical__c}"/></td>
                        <td height="23" class="headingsub2"><apex:outputField value="{!cp.Name}"/></td>
                        <td height="23" class="headingsub2"><apex:outputField value="{!cp.Type}"/></td>
                        <!--<td height="23" class="headingsub2"><apex:outputField value="{!cp.Type}"/></td>-->
                        <td height="23" class="headingsub2"><apex:outputField value="{!cp.Client_Rank__c}"/></td>
                        <td height="23" class="headingsub2"><apex:outputField value="{!cp.Account_Planlookup__c}"/></td>
                        <td height="23" class="headingsub2"><apex:outputField value="{!cp.Name}"/></td>
                        <td height="23" class="headingsub2"><apex:outputField value="{!cp.Type}"/></td>
                        <td height="23" class="headingsub2"><apex:outputField value="{!cp.Client_Rank__c}"/></td>
                    </tr>
                    </apex:repeat>
          </table>
        </td>
        
      </tr>
    </table></td>
    <td bgcolor="#FFFFFF" valign="top"></td>
    <td bgcolor="#FFFFFF" valign="top"></td>
  </tr>
  
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>

</table>
</apex:form>
</body>
</apex:page>
APEX Class
public with sharing class AccountSearchUI{    

    public ApexPages.StandardController stdController {get; set;}
    public Account acc {get; set;}
    public List<Account> accPList {get; set;}
    
    public String accountName ='';
    public AccountSearchUI(ApexPages.StandardController stdController){
    this.stdController = stdController;

    accPList = [select Group_Org__c, Vertical__c, Name, Type, Client_Rank__c, Top_25_Client__c, Account_Planlookup__c, Attachment_PDF__c from Account where Top_25_Client__c = true and Client_Rank__c < 26 order by Client_Rank__c ASC limit 10];        
    //accPList = [select Group_Org__c, Vertical__c, Name, Type, Client_Rank__c from Account where Top_25_Client__c = true and Client_Rank__c < 26 order by Client_Rank__c ASC limit 5];
    }
    
    List<selectOption> options = new List<selectOption>();
    public List<selectOption> getaccNames(){
    for(Account acc : [select id, Group_Org__c from Account])
    {
        options.add(new selectOption(acc.Group_Org__c, acc.Group_Org__c));
    }
        return options;
    }
}
I am getting the error as below

Error: Unknown property 'AccountStandardController.accGroup'

Need help on this code.
 
Best Answer chosen by Ravi_SFDC
Amit Chaudhary 8Amit Chaudhary 8
Please update your code like below
List<selectOption> options = new List<selectOption>();
    public List<selectOption> getaccGroup(){
    for(Account acc : [select id, Group_Org__c from Account where Group_Org__c != null ])
    {
        options.add(new SelectOption(acc.Group_Org__c, acc.Group_Org__c));
    }
        return options;
    }

Let us know if this will help you
 

All Answers

Tejpal KumawatTejpal Kumawat
Hi Venkata,

You have not defined option list in your class, so modify that options as per needed and add below snippet in your class.
public List<SelectOption> getAccGroup() {
	List<SelectOption> options = new List<SelectOption>();
	options.add(new SelectOption('--None--','--None--'));
	return options;
}
Regards
Tej Pal Kumawat
Skype : tejpalkumawat1991

If this answers your question mark Best Answer it as solution and then hit Like!


 
Ravi_SFDCRavi_SFDC

Hi Tej Pal,

Thank you for the catch. Now see my APEX Class as below

APEX Class

List<selectOption> options = new List<selectOption>();
    public List<selectOption> getaccGroup(){
    for(Account acc : [select id, Group_Org__c from Account])
    {
        options.add(new SelectOption(acc.Group_Org__c, acc.Group_Org__c));
    }
        return options;
    }

Now i am getting the below error as System.NullPointerException: Argument 1 cannot be null . Need help.
 

Amit Chaudhary 8Amit Chaudhary 8
Please update your code like below
List<selectOption> options = new List<selectOption>();
    public List<selectOption> getaccGroup(){
    for(Account acc : [select id, Group_Org__c from Account where Group_Org__c != null ])
    {
        options.add(new SelectOption(acc.Group_Org__c, acc.Group_Org__c));
    }
        return options;
    }

Let us know if this will help you
 
This was selected as the best answer