I have below static method where I am trying to add an Id to a set of Ids. This throws subject line error.

Can someone please let me know where i am doing wrong?

Apex Method

public Id currentRecordId {get;set;}

public static Set<Id> childrenIds {
  if( childrenIds == null ) childrenIds = new Set<Id> { };
        return childrenIds ;

    public static List<Account_Plan__c > contactListRemoting (String searchTerm) {
        List<Account_Plan__c > AccountPlansList = new List<Account_Plan__c>();
      childrenIds.add(ApexPages.CurrentPage().getparameters().get('Id')); // Error throws here.

      AccountPlansList = Database.query('....');

        return AccountPlansList ;

1 Answer 1


ApexPages.currentPage() only works for non-static Visualforce methods. You cannot get page parameters in a RemoteAction method.

Instead, pass the recordId in from the page:

public static List<Account_Plan__c > contactListRemoting (String searchTerm, Id recordId) {

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .