1

When i am trying to send parameter from Visul force remoting to apex method, it is saying that Unknown Method but method was exists in controller . Can anyone please help me how to fix this issue.

VF Page:

   <script>


    function GetCheckboxes(){

         var checkedBoxes = [];// It will holds the set of selected Id's
         checkedBoxes.push(getCheckedBoxes("mycheckboxes"));
        console.log('CheckboxId'+checkedBoxes);

        //CallMeth();


        Visualforce.remoting.Manager.invokeAction(
            '{!$RemoteAction.AccountTeamHandler.CallMeth}',
               checkedBoxes,
            function(result, event){
                if (event.status) {
                   console.log('I  am here remote');

                } else if (event.type === 'exception') {

                } else {

                }
            }, 
            {escape: true}
        );
    }

Class:

global without sharing  class AccountTeamHandler {


     global List<Id> Id {set;get;} 


       @RemoteAction
  global static  void  CallMeth(List<Id> Id){

         List<AccountTeamMember> Teammem=[select id,User.Name, User.Id from AccountTeamMember];
        // delete Teammem;
      system.debug('I am here'+Id);
      // return 'Ok';
       }

Error: Unknown method 'AccountTeamHandler.CallMeth()'

8
  • Is this class specified as controller/extension for the page? is this class saved?
    – kurunve
    Commented Aug 3, 2018 at 12:06
  • yes it is saved , when i am trying to send parameter then only this error is coming, if i remove parameter the error is not coming
    – Prince
    Commented Aug 3, 2018 at 12:08
  • What does console.log('CheckboxId'+checkedBoxes); print?
    – kurunve
    Commented Aug 3, 2018 at 12:13
  • Record Id's like (00q2D000000yRoA,00q2D000000yRoB,00q2D000000yRoc)
    – Prince
    Commented Aug 3, 2018 at 12:17
  • Is the page using the same controller? Also, just to check, did you try passing any other parameter, like string variable or is it giving problem only for array type? Commented Aug 3, 2018 at 12:33

2 Answers 2

1

You might be getting this error because of using the same controller method in a commandbutton on your VF page. This is because I am guessing commandbutton action methods cannot have parameters.

-1

I've been facing the same problem, changing the remote method parameter type to String instead of List solved my problem.

3
  • 2
    Welcome to SFSE! While this does look like an answer to the question, it could be made better with additional details. This answer would be improved if you found another source to back-up your claims (like part of the official Salesforce documentation), explained what you did to determine that a List<String> parameter doesn't work but a String parameter does, or provided an example of how to use your solution.
    – Derek F
    Commented Aug 3, 2018 at 16:07
  • 2
    Probably the easiest way to improve this answer would be to provide an example of how you can use a String parameter even if you really do need to pass a list of items. Remember, you're trying to provide a solution to the question being asked.
    – Derek F
    Commented Aug 3, 2018 at 16:10
  • I have changed the parameter as List<String> but still get the same error, For String also getting the same error:Unknown method 'AccountTeamHandler.CallMeth()'
    – Prince
    Commented Aug 3, 2018 at 16:32

You must log in to answer this question.

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