You need to sign in to do that
Don't have an account?
Calling from Extension
Hi VF board,
I am currently working with a VF page that is placed on the Opp page:
public class PullMilestones{ public Milestone__c[] milestones = new Milestone__c[0]; public PullMilestones(ApexPages.StandardController controller) { } public PageReference save() { UPDATE milestones; return null; } public Milestone__c[] getMilestones() { //Milestone__c[] milestones; milestones = [SELECT ID, Name, Duration__c, Status__c, Due_Date__c, Start_Date__c FROM Milestone__c WHERE Opportunity__c = :ApexPages.currentPage().getParameters().get('id') ORDER BY CreatedDate]; return milestones; } public Schedule__c[] getSchedule() { Schedule__c[] schedules; schedules = [SELECT ID, Name, Start_Date__c, End_Date__c FROM Schedule__c WHERE Project_Link__c = :ApexPages.currentPage().getParameters().get('id') ORDER BY CreatedDate]; return schedules; } }
On my VF page I have the lines:
<apex:page standardController="Opportunity" extensions="PullMilestones" showHeader="false" > <apex:form> <apex:pageBlock title="Schedule"> <apex:pageBlockTable value="{!schedules}" var="sched"> <apex:column headerValue="Name"> <apex:outputField value="{!sched.Name}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> <apex:form > <apex:pageBlock title="Milestones" mode="edit"> <apex:pageMessages /> ... <apex:pageBlockTable value="{!milestones}" var="m"> <apex:column headerValue="Name"> <apex:outputField value="{!m.Name}"/> </apex:column>
The table with value {!milestones} works fine but the {!schedules} does not.
I keep getting an error:
Error: Unknown property 'OpportunityStandardController.schedules'
I was wondering, how does the milestones value work and not the schedules (both being on the extension)? Is there a way to make it look at the extension rather than the StandardController?
Wow... Brain shut down for a bit there.
I was using {!Schedules}... the controller's method was getSchedule(), so I made it {!schedule} and it works.