• cbrin
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

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!

  • September 14, 2011
  • Like
  • 0