I am struggling to get my simple VF page to work as I keep getting an 'Unknown property 'AccountStandardController.CallCycle__c' error. Below is my VF form, and below that my Controller. I first tried just having the 2 variables CCStart and CCEnd and to use those on the form, but that also didn't work - I get the error 'Could not resolve the entity from <apex:inputField> value binding '{!CCStart}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable'. I then changed it to using the custom object instead, but that throws the other error. Please tell me where I'm going wrong - using the variables would be better, as I only need those for my query.
<apex:page StandardController="Account" extensions="AccountContactListRequestController" sidebar="true" showHeader="true">
<apex:form >
<apex:sectionHeader title="Account Contacts Print" subtitle="Request a print of Contacts for Accounts/Call Cycle range" />
<apex:pageBlock >
<apex:PageMessages />
<apex:pageBlockButtons >
<apex:commandButton id="Print" value="Print Contacts" action="{!PrintContacts}" />
<apex:commandButton id="Clear" value="Clear" action="{!Clear}" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="Call Schedule Cycle Details" columns="1">
<apex:inputField id="account" label="Account" value="{!Acct.Name}" required="true" />
<apex:inputField id="cycleStart" label="Call Cycle Start" value="{!CallCycle__c.CycleStart__c}" />
<apex:pageBlockSectionItem></apex:pageBlockSectionItem>
<apex:inputField id="cycleEnd" label="Call Cycle End" value="{!CallCycle__c.CycleEnd__c}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
global with sharing class AccountContactListRequestController {
public string AccountId { get; set; }
public string CCStart { get; set; }
public string CCEnd { get; set; }
public list<Id> AccountIds { get; set; }
public list<Account> Accounts { get; set; }
public CallCycle__c CallCycle { get; set; }
public Account Acct {get; set; }
ApexPages.StandardController stdCtrl;
public string dtNow {
get {
string dNow = String.valueOf(System.Now());
return dNow;
}
}
//-----------------------------------------------------------------------------------------
public AccountContactListRequestController(ApexPages.StandardController std) {
stdCtrl=std;
AccountId = ApexPages.currentPage().getParameters().get('id');
CallCycle = new CallCycle__c();
Acct = (Account)std.getRecord();
//set the account
if(AccountId != null){
Accounts = [Select Id, Name, Owner.Name, AccountNumber
From Account
Where Id = : AccountId];
}
else{
Accounts = [Select Id, Name, Owner.Name, AccountNumber
From Account
Where OtherPartyCode__c >=: CCStart and OtherPartyCode__c <=: CCEnd];
}
//get the contacts
List<Contact> contacts = [Select Id, Name, MobilePhone, Phone, Extension__c, Email, Title, Department, Generic_Department__c,
AccredoCRMGroup__c, LastCallCycleVisitOn__c, Last_Memo_Date__c, PreferredContactMethod__c,
Preferred_Day__c, Preferred_Time__c, Preferred_Time_Other__c, Role__c
From Contact
Where AccountId = : accountId and Inactive__c = false
Order By Generic_Department__c desc, Name asc];
system.debug(contacts.size());
system.debug(Accounts);
}
//-----------------------------------------------------------------------------------------
public PageReference PrintContacts() {
return ApexPages.CurrentPage();
}
//-----------------------------------------------------------------------------------------
public PageReference Clear() {
return ApexPages.CurrentPage();
}
}