0

I have written extension class for a page. Class is giving

error as "Error: Compile Error: Method does not exist or incorrect signature: ApexPages.CurrentPage.getParameters() at line 8 column 17".

public class TeamMemberExtension {

    Public Team_Member__c memberObj{get;set;}
    string memberId;

    public TeamMemberExtension(ApexPages.StandardController Controller)
    {
       memberId=ApexPages.CurrentPage.getParameters().get('id'); 
       if(memberId!=null && memberId!='')
       {
        memberObj = (Team_Member__c)Controller.getRecord(); 
        }
       else
       {
         memberObj = new Team_Member__c();
         }
    } 

    public PageReference save(){
     if(memberId!=null && memberId!='')
            update memberObj;
     else
            insert memberObj;
     return null;     
    }    

    public PageReference cancel()
    {
        return null;
    }

   /* public PageReference saveandnew()
    {
        if(memberId!=null && memberId!='')
            update memberObj;
     else
            insert memberObj;
     return page.TeamMember_New; 
    }*/
}
2

Change:

ApexPages.CurrentPage.getParameters().get('id')

to

ApexPages.CurrentPage().getParameters().get('id')

Refer documentation:

  1. getParameters()
  2. ApexPages Method
| improve this answer | |
  • 1
    I think that's perhaps not the most logical document to link to. ApexPages seems more apropos? – Adrian Larson Feb 17 '17 at 11:42

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.