+ Start a Discussion
Steven HoughtalenSteven Houghtalen 

how to call a method from execute anonymous

Hi,  I am having trouble calling a method from execute anonymous windew.  I must be missing something simple as documented examples look similar.   I developed a very simple case to demonstrate. 
Here is what I place in the window.
TestX();
I click on execute and the error message is: Method does not exist or incorrect signature: TestX()

The apex class is as follows:

public class TestX {
    Public Static void TestX(){
        integer x;
        x=7; 
    }
 }
Best Answer chosen by Steven Houghtalen
Amit Chaudhary 8Amit Chaudhary 8
try to call your method like below

TestX.TestX();

ClassName.StaticMethodName();

Let us know if this will help you


 

All Answers

Amit Chaudhary 8Amit Chaudhary 8
try to call your method like below

TestX.TestX();

ClassName.StaticMethodName();

Let us know if this will help you


 
This was selected as the best answer
Steven HoughtalenSteven Houghtalen
Ouch.  Of course.  Thanks Amit.  Much appreciated.
 
Steven HoughtalenSteven Houghtalen
.