You need to sign in to do that
Don't have an account?
Unknown Property Error using Custom Controller
I am getting "Unknown Property Error using Custom Controller" for the following VF page. I am not sure what I am missing.
Controller:
VF Page
Controller:
public with sharing class ImplementationTaskReportCtrl { public String PLAN_YEAR_ID; public final String SHOW_IMPTS = 'show'; public List<Implementation__c> Implementation{get;set;} public List<Implementation_Task__c> ImplementationTasks{get;set;} public ImplementationTaskReportCtrl () { PLAN_YEAR_ID = Apexpages.currentPage().getParameters().get('Id'); if( PLAN_YEAR_ID instanceof Id ){intialize();} else{Apexpages.addMessage( new Apexpages.Message( ApexPages.Severity.ERROR, Label.Invalid_Id_Error ) );} } private void intialize() { Implementation = [ SELECT Id, Name, Total_Required_Tasks__c, Plan_Year_1__c, Percent_Complete__c, Completed_Tasks__c, ( SELECT Name, Completed_Date__c, Due_Date__c, Current_Notes__c, Historical_Notes__c FROM Implementation_Tasks__r WHERE In_Reports__c = :SHOW_IMPTS ORDER BY Due_Date__c ) FROM Implementation__c WHERE Plan_Year_1__c = :PLAN_YEAR_ID ]; if( Implementation == NULL || Implementation.isEmpty() ) { Apexpages.addMessage( new Apexpages.Message( ApexPages.Severity.ERROR, Label.No_Plan_Year_Related_IMP_Error ) ); } else { ImplementationTasks = [ SELECT Name, Implementation__c, Completed_Date__c, Due_Date__c, Current_Notes__c, Historical_Notes__c FROM Implementation_Task__c WHERE Implementation__c IN :Implementation AND ( Due_Date__c < TODAY OR Due_Date__c = THIS_WEEK ) AND Completed_Date__c = null ORDER BY Due_Date__c ]; } } public PageReference saveIMPTasksDueThisWeekAndStay () { return save( ImplementationTasks, false ); } public PageReference saveIMPTasksDueThisWeekAndGoBack () { return save( ImplementationTasks, true ); } public PageReference saveIMPTasksAndStay () { List<Implementation_Task__c> IMPTasksToBeSaved = getAllIMPTasks(); return save( IMPTasksToBeSaved, false ); } public PageReference saveIMPTasksAndGoBack () { List<Implementation_Task__c> IMPTasksToBeSaved = getAllIMPTasks(); return save( IMPTasksToBeSaved, true ); } private List<Implementation_Task__c> getAllIMPTasks () { List<Implementation_Task__c> IMPTasksToBeSaved = new List<Implementation_Task__c>(); for( Implementation__c aIMP : Implementation ) { for( Implementation_Task__c aTask : aIMP.Implementation_Tasks__r ) { IMPTasksToBeSaved.add( aTask ); } } return IMPTasksToBeSaved; } private PageReference save ( List<Implementation_Task__c> IMPTasksToBeUpdated, Boolean goback ) { try { update IMPTasksToBeUpdated; } catch ( Exception ex ) { Apexpages.addMessage( new Apexpages.Message( ApexPages.Severity.ERROR, ex.getMessage() ) ); return NULL; } return ( goback ? back () : stay() ); } public PageReference back() { return new PageReference ( '/' + PLAN_YEAR_ID ); } private PageReference stay() { intialize(); return NULL; } }
VF Page
<apex:page id="IMPTaskReport" controller="ImplementationTaskReportCtrl" sidebar="True" > <style type="text/css"> div.pbSubheader{ color:black !important; } .textArea-currentNotes-pbt { resize: none; width: 85%; } </style> <script> function setFocusOnLoad() {} </script> <apex:PageMessages id="msgs"/> <!-- <apex:includeScript value="{!$Resource.sorttableJS}"/> --> <apex:form > <apex:pageBlock title="Implementation Tasks Due This Week"> <apex:PageBlockButtons > <apex:commandButton value="Save and Close" action="{!saveIMPTasksDueThisWeekAndGoBack}" rerender="msgs"/> <apex:commandButton value="Save and Stay" action="{!saveIMPTasksDueThisWeekAndStay}" rerender="msgs, pb, pbt-1"/> <apex:commandButton value="Close" action="{!back}"/> </apex:PageBlockButtons> <apex:pageBlockTable id="pbt-1" value="{!ImplementationTasks}" var="impTask"> <apex:column headerValue="{!$ObjectType.Implementation_Task__c.fields.name.label}" width="15%"> <apex:outputLink value="/{!IMPTask.ID}" target="_blank"> {!IMPTask.name} </apex:outputLink> </apex:column> <apex:column value="{!IMPTask.Implementation__c}" width="10%"/> <apex:column value="{!IMPTask.Implementation_1__c}" width="10%"/> <apex:column headerValue="{!$ObjectType.Implementation__c_Task__c.fields.Completed_Date__c.label}" width="5%"> <apex:inputField value="{!IMPTask.Completed_Date__c}" /> </apex:column> <apex:column headerValue="{!$ObjectType.Implementation__c_Task__c.fields.Due_Date__c.label}" width="10%"> <apex:inputField value="{!impTask.Due_Date__c}" /> </apex:column> <apex:column headerValue="{!$ObjectType.Implementation__c_Task__c.fields.Current_Notes__c.label}" > <apex:inputTextArea rows="3" value="{!IMPTask.Current_Notes__c}" styleClass="textArea-currentNotes-pbt"/> </apex:column> <apex:column headerValue="{!$ObjectType.Implementation_Task__c.fields.Historical_Notes__c.label}" > <apex:inputTextArea disabled="true" rows="3" value="{!IMPTask.Historical_Notes__c}" styleClass="textArea-currentNotes-pbt" /> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlock id="pb" title="Plan Year Related Implementation Tasks"> <apex:PageBlockButtons > <apex:commandButton value="Save and Close" action="{!saveIMPTasksAndGoBack}" rerender="msgs"/> <apex:commandButton value="Save and Stay" action="{!saveIMPTasksAndStay}" rerender="msgs, pbt-1, pb "/> <apex:commandButton value="Close" action="{!back}"/> </apex:PageBlockButtons> <apex:repeat id="rpt" value="{!Implementation}" var="IMP"> <apex:pageBlockSection title="Title" collapsible="true" rendered="false"/> <apex:pageBlockSection title="{!IMP.Name} : {!$ObjectType.Implementation__c.fields.Completed_Tasks__c.label}: {!IMP.Completed_Tasks__c}, {!$ObjectType.Implementation__c.fields.Total_Required_Tasks__c.label}: {!IMP.Total_Required_Tasks__c}, {!$ObjectType.Implementation__c.fields.Percent_Complete__c.label}: {!IMP.Percent_Complete__c}" columns="1" collapsible="true"> <apex:pageBlockTable id="IMPtable" value="{!sos.Implementation_Task__r}" var="IMPTask"> <apex:column headerValue="{!$ObjectType.Implementation_Task__c.fields.name.label}" width="15%"> <apex:outputLink value="/{!IMPTask.ID}" target="_blank"> {!IMPTask.name} </apex:outputLink> </apex:column> <apex:column value="{!IMPTask.Implementation_1__c}" width="15%"/> <apex:column headerValue="{!$ObjectType.Implementation_Task__c.fields.Completed_Date__c.label}" width="5%"> <apex:inputField value="{!IMPTask.Completed_Date__c}" /> </apex:column> <apex:column headerValue="{!$ObjectType.Implementation_Task__c.fields.Due_Date__c.label}" width="9%"> <apex:inputField value="{!IMPTask.Due_Date__c}" /> </apex:column> <apex:column headerValue="{!$ObjectType.Implementation_Task__c.fields.Current_Notes__c.label}" width="28%"> <apex:inputTextArea rows="3" value="{!IMPTask.Current_Notes__c}" styleClass="textArea-currentNotes-pbt"/> </apex:column> <apex:column headerValue="{!$ObjectType.Implementation_Task__c.fields.Historical_Notes__c.label}" width="28%"> <apex:inputTextArea disabled="true" rows="3" value="{!IMPTask.Historical_Notes__c}" styleClass="textArea-currentNotes-pbt" /> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:repeat> </apex:pageBlock> </apex:form> </apex:page>
I found some flaws in your code. Use the below code: Let me know, if you need any other help.
Thanks,
Neetu
All Answers
I do not see you described sos anywhere.
Also, You did not include Implementation_1__c in your query. This will also throw an error.
Le
I found some flaws in your code. Use the below code: Let me know, if you need any other help.
Thanks,
Neetu