You need to sign in to do that
Don't have an account?
Ron Planken
JsRemote error while updating the Apex class
While working on a new jsRemote based VisualForce page I have been getting some random errors. The setup is as followed:
I have a public class that is the main controller for a VisualFoce Page. In this VisualForce page I have multiple Extentions that implement a RemoteAction. I call the RemoteAction from my javascript to fill the page with data. Now, this all works like a charm. The page loads, it gets the data and then builds the HTML on the page.
Now the error shows up when I change something in the Apex code, either in the controller or one of the Extentions and shows up like this:
The weird thing is that this error shows up sometimes even after only changed a space or something else small. This error keeps showing up, just untill I reupload the VisualForce page. After that, it works immediately and the error is gone. As you can see, I have no Global classes or Public classes and its all run from Salesforce itself. The odd thing is that the moment I recompile/reupload the VisualForce page everything is working again.
Has anyone seen this error before? And perhaps know where I'm doing things wrong?
I have a public class that is the main controller for a VisualFoce Page. In this VisualForce page I have multiple Extentions that implement a RemoteAction. I call the RemoteAction from my javascript to fill the page with data. Now, this all works like a charm. The page loads, it gets the data and then builds the HTML on the page.
public with sharing class ExampleClassExt { public ExampleClass (ExampleHome ctl){ } @RemoteAction public static list<CustomObject> body(String employeeId) { } }
Visualforce.remoting.Manager.invokeAction( "c.ExampleClassExt.body", Employeeid, function(result,event){ if(event.status){ doStuff(); } });
Now the error shows up when I change something in the Apex code, either in the controller or one of the Extentions and shows up like this:
Apex script unhandled exception by user/organization: 00xxxxxxx/00Dxxxxxxxxx Visualforce-pagina: /apex/c__ExampleHome caused by: line 8, column 40: Public remoted methods not allowed in global components
The weird thing is that this error shows up sometimes even after only changed a space or something else small. This error keeps showing up, just untill I reupload the VisualForce page. After that, it works immediately and the error is gone. As you can see, I have no Global classes or Public classes and its all run from Salesforce itself. The odd thing is that the moment I recompile/reupload the VisualForce page everything is working again.
Has anyone seen this error before? And perhaps know where I'm doing things wrong?
Waqar Hussain SF
Define you remoteAction method and class as global, it probably solve your problem.
Ron Planken
Thanks for the info. We were kinda trying to not go that route quite yet and hope there was a different solution for it.
Brandon Feather
Ron I have been running into the same issue what did you end up doing?
Ron Planken
Brandon, unfortunatly the only solution we found was to actually make the classes and methods globals.. It works like a charm now, but it does have the downside of all globals being kinda permanent.