Is it possible to use javascript remoting in a custom button? I'm aware you can use the AJAX toolkit to call a webservice method but was hoping it might be possible to call a @remoteAction and not have to worry about any API limits.

I've tried so far with no success.

Any help is appreciated!

  • 2
    JS-Remoting is only for use in VF, so not directly. However I guess you can redirect to a VF Page on click, which has an onload action method to execute an action method ? Commented Jun 11, 2013 at 18:41
  • Hm, yeah my original idea was just a regular VF page with an action on loading and a redirect with no javascript. However, the security scanner doesn't seem to like DML operations on the page load action.
    – Phil B
    Commented Jun 11, 2013 at 18:42
  • Is @future invocation permitted in that context? You might be able to get away with delegating DML to future, unless you need it to be synchronous. Commented Jun 11, 2013 at 18:45
  • 1
    I reckon invoking a webservice method via the AJAX toolkit is the way to go then, what sort of API limits are you concerned about in particular? The API Limits are usually quite high (factor of thousands multiplied by user licenses) and they are org-wide. Commented Jun 11, 2013 at 18:55
  • 1
    By the way, the reason for "not liking" DML on page load is for XSRF issues (e.g. I send you a specially crafted image link in HTML, and it causes you to delete records). Turning on "GET XSRF Protection" is an appropriate solution if you still want to DML on page load.
    – sfdcfox
    Commented Jul 19, 2013 at 19:16

1 Answer 1


No, it's not possible right now.

Other options:

  1. Add all of the desired functionality in a Visualforce page then use JavaScript to redirect to it (or potentially do an HTTP POST).
  2. Use the AJAX Toolkit to call a webservice method (as you mentioned).

You must log in to answer this question.

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