• jdance1.3948195933250098E12
  • NEWBIE
  • 20 Points
  • Member since 2014

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

Hi,

 

I am attempting to use the new $RemoteAction variable and Visualforce.remoting.Manager.invokeAction() function in the summer 12 release.

 

I have successfully used them to call a remote action function when that function takes a single argument as its input, e.g.


Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemoteController.test1Str}','1 argument', handleReturn,{escape: true});

 

I have methods currently working in salesforce which accept 0 and 2 or more arguments. The obvious way of calling these to me would be to simply include the arguments separated by commas as that is what is done with the current calls, e.g.

RemoteController.test0Str( handleReturn,{escape: true})

 would map to

Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemoteController.test0Str}', handleReturn,{escape: true});

 and likewise for 2 arguments:

RemoteController.test2Str('2','arguments',  handleReturn,{escape: true})
Visualforce.remoting.Manager.invokeAction('RemoteController.test2Str','2','arguments', handleReturn,{escape: true})

 But for these two cases I get the following logged to the JS console:

Visualforce Remoting: Parameter length does not match remote action parameters: expected 0 parameters, got
Visualforce Remoting: Parameter length does not match remote action parameters: expected 2 parameters, got  

 So it is clear that salesforce know what it is expecting, but it is not clear how I pass the arguments.

 

I have also attempted passing the arguments as an array ,e.g.

[]
['1 argument']
['2','arguments']

 and (in desparation) as a single object with the argument names as the parameter names! None of this works.

 

Has anyone had any success using remoting in this fashion? There is a gist of my code at https://gist.github.com/2713502.

 

Regards,

 

James

Hi,

 

Is there a way to select everything in SOQL like "SELECT *" in SQL? I have looked at the SOQL manual about SELECT statements but it didn't tell if I can do this or not.

 

Thanks.

  • September 08, 2009
  • Like
  • 1