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
aadit_13aadit_13 

Unknown property AccountStandardController

Hi I am getting the error Unknown property AccountStandardController.

 

<apex:page standardController="Account" extensions="CampaignHistory_account">
<style>
.fewerMore { display: none;}
</style>
<apex:form >
 <apex:pageMessages />
 <apex:detail relatedList="true"></apex:detail>
<apex:pageblock id="CustomList" title="Related Campaign History"  >
   <apex:pageBlockTable value="{!cntct}" var="c" rendered="{!NOT(ISNULL(cntct))}">
        <apex:column value="{!c.FirstName}"/>
   </apex:pageBlockTable>
   <apex:outputLabel value="No records to display" rendered="{!(ISNULL(cntct))}" styleClass="noRowsHeader"></apex:outputLabel>
 </apex:pageblock>
</apex:form>
</apex:page>

 

public class CampaignHistory_account {
    private List<Contact> cntct;
    private Account accnt;
    public CampaignHistory_account(ApexPages.StandardController controller) {
        this.accnt= (Account)controller.getRecord();
    }
    public List<Contact> getCampaignHistory()
    {
        Contact con = [Select id, Account.id FROM Contact where Account.id = :accnt.id];
        if (con.Account == null)
         return null;
        cntct = [Select Contact.FirstName, (Select CampaignMember.Status from Contact.CampaignMembers where CampaignMember.ContactId = :con.id) From Contact Where Contact.id= :con.id];
        return cntct;
    }
}

 

 

SargeSarge

Hi,

 

  You need to make the variable "cntct" as public with getters and setters like below

 

 

public List<Contact> cntct {get; set;}

 

 

Hope this helps

 

 

aballardaballard

you also need some code somewhere that calls getCampaignHistory to initialze cntct

aadit_13aadit_13

Thank you,

 

Now its working the problem was with get method.