Skip to main content
12 votes
Accepted

RemoteAction Vs REST? Which is faster?

@RemoteAction is the fastest you can go without using API calls. If you don't mind using API calls, the AJAX Toolkit is very slightly faster. That said, a well-written RemoteAction can easily run in 1/...
sfdcfox's user avatar
  • 495k
9 votes
Accepted

Javascript remoting for Apex

As for CSRF, @ca_patterson has already answered that on Javascript Remoting CSRF. As for users interacting directly with the methods, it certainly is possible, if someone has the correct knowledge. ...
Adrian Larson's user avatar
  • 150k
7 votes
Accepted

How to return the Array or List from RemoteAction Method to Javascript?

I suggest return the JSON string from method like.. first serialize the list and return global static String attachBlob(List<Attachment> getResult) { // your code return JSON....
Ratan Paul's user avatar
  • 22.7k
7 votes

How can I stop JavaScript remoting reloading page

By default, a button will cause a form submit. You have to prevent this default either by cancelling the default behavior, or by returning "false" from your handler. The easiest method is to simply do ...
sfdcfox's user avatar
  • 495k
6 votes

Javascript remoting for Apex

Cross-Scripting Protection There's a CSRF token that has to be presented in the payload: { "action":"myns.remote", "method":"method", "data":null, "type":"rpc", "tid":2, "ctx": { "csrf": "...
sfdcfox's user avatar
  • 495k
5 votes
Accepted

Illegal Assignment Error on custom object and query

Adding aggregate functions such as SUM changes the result of the query to be an array of AggregateResult objects. In general, the aggregation might be creating new values such as a COUNT() of the ...
Keith C's user avatar
  • 136k
5 votes
Accepted

Variable does not exist in method

searchDir is an instance variable. It is bound to a specific instance of the class Direccion - here, the controller extension. static methods, such as @RemoteAction JavaScript remoting actions, aren'...
David Reed's user avatar
  • 93.1k
4 votes
Accepted

How to test these class methods, one of which is a remote action?

Here is a skeleton of what your tests should look like: @IsTest class MyCustomControllerTests { // Method stubs below } Testing Your Constructor static testMethod void testConstructor() { //...
Adrian Larson's user avatar
  • 150k
4 votes

Why actionFunctions are not as fast as RemoteAction

In the thread @sfdcfox have provided several good points.Posting some of them which are related to your answer: @RemoteAction methods require less bandwidth, and server processing time, because only ...
Mr.Frodo's user avatar
  • 5,802
4 votes
Accepted

@remoteAction unexpected token: 'User'

@Remoteaction is denoting a method always. You have missed () enclosing parenthesis. This is how a method is declaring. [public | private | protected | global] [override] [static] ***data_type*** ...
Reshma's user avatar
  • 4,039
4 votes
Accepted

Get current user full name and id in Javacript page

You can just merge the $User global variables into your markup: var runningUserId = "{!$User.Id}" Or you can use UserInfo methods in Apex. Don't use dynamic queries unless static queries won't work ...
Adrian Larson's user avatar
  • 150k
4 votes
Accepted

Upload large ContentVersion records

Well, I solved this. Sort of. My solution was to forgo the use of a @RemoteAction and instead use Salesforce's REST services. For those following at home home, there are two ways to do this: 1. The ...
AvailableName's user avatar
3 votes
Accepted

Visualforce is not defined while using visual force remoting

You need to define a controller. Change: <apex:page showHeader="true" sidebar="true"> to: <apex:page controller="CaseDetailController" showHeader="true" sidebar="true">
Adrian Larson's user avatar
  • 150k
3 votes
Accepted

javascript remoting

Here you go: Tried this in my org and it works. Remember this is Javascript so you cannot use the "Integer" keyword in the for loop. Also fixed up the looping mechanism. Please use better naming ...
Richard N's user avatar
  • 3,812
3 votes
Accepted

JSON noobie question - No serializer found for class common.apex.json.ApexJsonGenerator

The simpler API to use for this situation is JSON.serialize: global without sharing class Article_Controller { @RemoteAction global static String getQuickText() { return JSON....
Keith C's user avatar
  • 136k
3 votes
Accepted

How to Access the Map values from the Remote Invoking

Try Below var AccountValue= [result.length]; for (var key in result) { AccountValue[0][0] = result[key].Id AccountValue[0][1] = result[...
Lemon's user avatar
  • 895
3 votes
Accepted

Salesforce @RemoteAction not redirecting the VF page

RemoteAction functions cannot automtically redirect a user. Consider using an apex:actionFunction instead: <apex:actionFunction name="createCommunityUser" action="{!createCommunityUser}" reRender="...
sfdcfox's user avatar
  • 495k
3 votes
Accepted

Test Class for the RemoteAction with HttpsRequest

Testing HTTP Callouts by Implementing the HttpCalloutMock Interface global class ***YourHttpCalloutMockImpl*** implements HttpCalloutMock { global HTTPResponse respond(HTTPRequest req) { /...
RCS's user avatar
  • 2,108
3 votes

VF page inside a lightning component - Issue with Visualforce Remoting: Javascript proxies were not generated for controller

The potential solutions are as follows. apex:page action You can use a page action to do something when the page loads. Inline JSON You can communicate values to the page by using a getter: var ...
sfdcfox's user avatar
  • 495k
3 votes

Javascript Remoting salesforce unknown property remote action

You need to use $RemoteAction, not RemoteAction, and the class name and method name must match: Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.JavascriptRemotingController.AccountName}',...
sfdcfox's user avatar
  • 495k
2 votes

Remote Action not working in JavaScript

You can use the Window Variable in your page and later read from there In your visualforce page add this <script> configSettings = { remoteActions: { ...
Mohith Shrivastava's user avatar
2 votes

How to return the Array or List from RemoteAction Method to Javascript?

In addition to @Ratan answer, you need to explicitly set the escape attribute to false which is true by default. FileUploadController.attachBlob(getResult, function(result, event) { //Proceed ...
Praveen's user avatar
  • 10.1k
2 votes
Accepted

RemoteAction not respecting sharing settings

I was only able to reproduce the behavior you describe by changing the controller to without sharing. Regardless, this workaround should let you filter out records which should not be viewable: @...
Adrian Larson's user avatar
  • 150k
2 votes
Accepted

How to pass nested collection within JavaScript remoting

Remote Method Overrides in Remote Objects example uses Map<String, Object> as third parameter in RemoteAction. That's useful, because we could send any primitive or any collection of primitives ...
Ilya Lepesh's user avatar
  • 4,125
2 votes

Multiple Apex controllers in Angular app

That's what extensions are for. You can include as many extensions as you like on your page. This is great also for reusable code. <apex:page standardController="Account" extensions="ExtA,ExtB,...
sfdcfox's user avatar
  • 495k
2 votes

Limit for javascript remoting request

Using REST api is much better option than sending via remote action methods. Remote action methods have a limitation of number of character (1000000) that can be sent from a page to apex controller....
Sam's user avatar
  • 4,383
2 votes

Visualforce Remoting Correct Approach?

I will prefer the first approach of using $RemoteAction Visualforce.remoting.Manager.invokeAction("{!$RemoteAction.controller.getParam1}", aninputhere, function(result,event){ The reason is this is ...
Mohith Shrivastava's user avatar
2 votes
Accepted

Visualforce Remoting Correct Approach?

Just verbosity. I prefer the latter because it is more concise. As far as I know, that's the only difference. As a direct consequence, it is also somewhat easier to pass the reference to a static ...
Adrian Larson's user avatar
  • 150k
2 votes
Accepted

Calling a remote action in Angular

So the main problem is Merge fields only work in VF pages. If you check this line https://github.com/tylerzika/taskCalendar/blob/master/app/task/task-calendar-controller.js#L32 You have a merge ...
Avidev9's user avatar
  • 5,659
2 votes
Accepted

"Visualforce Remoting: Javascript proxies were not generated for controller xyz: may not use public remoted methods inside an iframe."

This issue is not because of remote actions basically. Wherever we were calling remote actions using html tags in vf page, we were getting this error. We replaced html tags with apex tags (commandlink)...
Garima Kour's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible