How to call a Remote Action

  • 1
  • Problem
  • Updated 3 years ago
  • Solved
Hello, 

we tried to follow the process described here to call remote action in skuid:

http://inversion.consulting/tag/skuid/ 

We created the following snippet:

                xxxx.test(JSON.stringify(mypar), function(result, event) {                    if (event.type == 'exception') {
                        skuid.jQuery.unblockUI();
                        alert(event.message);
                    }else{
                 skuid.model.updateData([contactModel],function(){
                            skuid.jQuery.unblockUI();
                            console.log('...OK:');
                            console.log(response);
                        });     
                    }
                }); 
When we try to call it we receive the error "ReferenceError: xxxx is not defined".

here our class: 


global class xxxx {

    @RemoteAction
    global static void test(String y) {    
        system.debug('hello');
    }


Thank you.

Gabriele
    
Photo of dibe84

dibe84

  • 212 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
You have to modify your Visualforce "override" Page to include the Apex Class containing your Remote Action as an extension controller, otherwise the Remote Action will not be callable from JavaScript.

Follow the steps described in Item 4 from the "official response" to this Community post: Calling apex function
Photo of dibe84

dibe84

  • 212 Points 100 badge 2x thumb
Thank you very much Zach, it worked!

Just a curious issue: when I open the page with chrome on mac it works perfectly, when I open the same page on chrome from widows all the font are changed to Times new Roman (instead of the defualt lightning font of skuid)