function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dipu2dipu2 

Does JavaScript Remoting require the controller function to be global?

I just started to use JavaScript remoting. It seems the function called from JavaScript remoting should be global in a managed package.

Oh no, that is a bummer. I do not like to make any Apex class or function global unless it is extremely necessary. Once it is global I cannot change the name of the controller and the global function.  

 

Thanks,

Dipu

Best Answer chosen by Admin (Salesforce Developers) 
Abhinav GuptaAbhinav Gupta

Yes, as of now we need GLOBAL classes/methods for remoting. But this limitation would be waved off in coming spring'12 release, one can use the normal public classes with JS Remoting.

All Answers

Abhinav GuptaAbhinav Gupta

Yes, as of now we need GLOBAL classes/methods for remoting. But this limitation would be waved off in coming spring'12 release, one can use the normal public classes with JS Remoting.

This was selected as the best answer
Ankit AroraAnkit Arora

Abhinav is absolutely right. For now you need to make the method global.

 

http://forceguru.blogspot.com/2011/06/summer-11-features-part-2-javascript.html

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

dipu2dipu2

I just tried on a Sandbox on Spring12. I am  getting the Installed Managed class MyClass is not visible message.

Where is the information about Spring 12 support for public classes to have JavaScript remoting.

cwall_sfdccwall_sfdc

This could be related to an Apex permissioning issue that R&D is investigating.

cwall_sfdccwall_sfdc

Note that "one can use the normal public classes with JS Remoting" is not entirely true.  Public methods are allowed when they meet the conditions noted in the "Declaring a Remote Method" secion of the docs:

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_js_remoting.htm

hemmhemm

I can confirm that public remote methods in your public controller are not visible in Managed Packages. You can put public methods in global classes and remoting will work, but you'll get compilation errors in other places saying those methods are not allowed. You can make them global methods, but this requires a new Managed-Released version of your app instead of a patch.  Ugh!

 

I've been told a bug is logged with the Visualforce team and hopefully it's a priority. In terms of managed packages, remoting isn't really a development option at this time. :(