function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CB312CB312 

Visualforce Remoting Exception

Hi All,

 

Has anyone ever expierenced this error when using Javascript Remoting?

 

Visualforce Remoting Exception: Method 'updateMerchantProduct' not found on controller ManageLeadsRemote. Check spelling, method exists, and/or method is RemoteAction annotated.

 

Serialzed Code:



global with sharing class ManageLeadsRemote {
   
    @RemoteAction
    global static sObject[] searchMerchants(String divisionName, string MerchantType) 
        {    
            //This Function Works 
        }
    
    
    @RemoteAction
    global static boolean updateMerchantProduct(String MerchantType, String recordID, String ProductLine) 
        {
        system.debug('------------------------DEBUG---if you can read this we got in to this function');
            boolean updateCheck = false;
            if(MerchantType=='Account')
                {
                    update new Account(Id = recordID, CurrentProduct__c = ProductLine);
                    updateCheck = true;
                }
            if(MerchantType=='Lead')
                {
                    update new lead(Id = recordID, CurrentProduct__c = ProductLine);
                    updateCheck = true;
                }
            return updateCheck;
        }

}

 Javascript Code in my VisualForce Page that enacts this method:

function updateAccount(MType, acc, newVal) 
    {
        // Javascript Remoting to update Accout record
        alert(MType);
        alert(acc);
        ManageLeadsRemote.updateMerchantProduct(MType, acc.Id, newVal, function(result, event)
            {         
               if (event.status && event.result) 
                   {       
                          alert('Good Job - this worked!');
                   } else 
                       {
                          alert(event.message);
                       }
            }, {escape:true});
    }

 

I have a feeling the error message that is being thrown is not the error that is actually occuring, the alerts are firing before the updateMerchantProduct remote function and are passing in the correct params. So I'm stuck on this....

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
NaoNao

Hi,

 

I just met same error and foud solution, so I share it.

In my case, it sometimes work, and it sometimes cause error 'Visualforce Remoting......Method not found...'

 

Tell solution first, make sure parameter types are exactly matched between Apex and JavaScript.

 

Pitfall was, in my case, I sent NULL to boolean type parameter, so I forced it to FALSE when send to remote function.

Also, in javascript, number could be string or numeric.  '1'-0 become number, 1+'' become string, so just make sure type in javascript.

 

Cheers!

Nao 

All Answers

cwall_sfdccwall_sfdc

Everything looks correct in your source.  It must be a runtime issue.

 

Are any updateMerchantProduct params undefined - acc.Id, maybe?  If so, Visualforce remoting will not be able to determine the appropriate method to invoke because method param count is not as expected.

Starz26Starz26

I just came across this error.

 

My method works in Firefox, IE 8 and 9 from multiple computers. Now the curent computer I am using is on IE7 and I am getting this error. Using firefox on same computer it runs fine so I am pretty sure it is a browser issue blocking something.

 

Not sure I want to spend the time trying to track it down either.....

 

Has anyone found the specific issue that causes this?

cbrincbrin

I got this error when I was trying to pass a javascript object or string to my remoting method and my method was expecting and integer. I'm not sure if that is the only thing that would trigger the error but I think it might be a general javascript error.

NaoNao

Hi,

 

I just met same error and foud solution, so I share it.

In my case, it sometimes work, and it sometimes cause error 'Visualforce Remoting......Method not found...'

 

Tell solution first, make sure parameter types are exactly matched between Apex and JavaScript.

 

Pitfall was, in my case, I sent NULL to boolean type parameter, so I forced it to FALSE when send to remote function.

Also, in javascript, number could be string or numeric.  '1'-0 become number, 1+'' become string, so just make sure type in javascript.

 

Cheers!

Nao 

This was selected as the best answer
AnthonyBAnthonyB
Just encountered this error message and thought I'd post my "solution"

In my case, the RemoteAction is running a query and returning results. Worked fine for 9 months then users started seeing this error message. Works ok for Admins but not users. I removed "Create" on Account for affected users the day before so when I restored "Create" on Account, viola, it started working.

I plan to revisit this issue of revoking "Create" on Account but just thought I'd share my experience as it was not related to a browser or Javascript.