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

Accessing class functions and variables from RemoteAction function



I'm trying to access a class function from a RemoteAction function. 


The function I was trying to access is not static, while the RemoteAction function must be static. This causes the "Method does not exist or incorrect signature" error.


So I changed the function I was calling to be static, which gets rid of that error. But that creates a new error, because the function is trying to call an instance variable which is not static - "Variable does not exist". Addiing static to that variable does not change anything. 


Something like this:


global with sharing class MyClass {
public static String myVar {get;set;}
public static void myClassFunction(String id){
myVar = '';
global static string updateRecord(String id){
return '1';


 What's the right way to do this?



It's still saying MyVar doesn't exist after you have added static to it?


You should probably log a case if that's still and actually the case.  That seems incorrect to me.