Can anyone please help me figure out why I'm getting the error mentioned in the thread title? I'm trying to build a simple VF page with a custom controller.


VF page:

<apex:page controller="DuplicateQARelController">
<apex:form >

<apex:pageBlock title="Duplicate QA task/(s) details">

     <apex:pageBlockTable value="{! releases }" var="qa">

         <apex:column headerValue="QA Release Id">
              <a href="/{!qa.Id}">
                  <apex:outputField value="{!qa.Name}"/>

         <apex:column value="{! qa.Owner.Name }"/> 
         <apex:column value="{! qa.Objective__c }"/> 
         <apex:column value="{! qa.Due_Date__c }"/>





Controller code:

public with sharing class DuplicateQARelController{

//Declare the variables to be used
public List<QA_Release__c> releases {get;set;}
private Id releaseClientId;

//Put all code inside constructor since it will be initialized when page is rendered
public DuplicateQARelController() {

    //Extract the Id of the current QA Release record 
    Id qaId = ApexPages.currentPage().getParameters().get('id');

    //Extract the client Id from the above record
    QA_Release__c qaRel = [SELECT Client__c FROM QA_Release__c
                           WHERE Id= :qaId ];
    releaseClientId     = qaRel.Client__c;

    //Find all QA Release records with above Client 

    releases = [SELECT Name, Owner.Name, Objective__c, Due_Date__c 
                FROM QA_Release__c 
                WHERE (Id = :releaseClientId AND 
                (Status__c='Not Started' OR Status__c = 'In Progress' OR
                 Status__c = 'On Hold' OR Status__c ='Re-opened')) ];


  • Can you first save controller and then create VF ?I dont see anything wrong here – Mohith Shrivastava Mar 21 '15 at 20:25
  • Thank you. It worked. I wonder why it wasn't working earlier. – Mayank Srivastava Mar 21 '15 at 22:12
  • Can you mark as an answer ? – Mohith Shrivastava Mar 21 '15 at 22:15

The issue happens when we dont save the controller before the Visualforce Markup is saved .

Solution is to make sure Apex class is saved and then VF tags are Saved .

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.