+ Start a Discussion

How to reference a global method

Hi All,
I have a class that i had to change to global due to the total characters limit. Now i want to reference the methods in this global class in another global class. I have searched the discussion boards but i keep getting: Method does not exist or incorrect signature
Please see the 2 classes below. How do i reference a method from the one global class in the other class? 

global class Recruitement_Dashboard_Controller{ private List<table> invitetracking; public Recruitement_Dashboard_Controller(ApexPages.StandardController controller) { invitetracking = [SELECT Id FROM table];system.debug('invitetracking: '+invitetracking); } //Global Counts****************************************************************************************************************// Public Integer getAcceptedMemberCount(){ Integer counter = 0; for(Invite_Tracking__c it : invitetracking){ if(field == 'text' && field == '1') counter += field.intValue();} system.debug('counter: '+counter); return counter; }


global class Recruitement_Dashboard_Controller2{ Public Integer test(){ Recruitement_Dashboard_Controller.getAcceptedMemberCount(); } }



Please help!!
Try making your getAcceptedMethodCount() method global - at the moment its public.
Message Edited by bob_buzzard on 03-26-2010 03:15 AM
Hi bob_buzzard,

Thanks for the reply!

I did try that, but still the same results :(

Do you get any compile errors compiling your Recruitement_Dashboard_Controller?


When I paste it into my dev org, I get:


sObject type 'table' not supported.




Message Edited by bob_buzzard on 03-26-2010 03:50 AM
Message Edited by bob_buzzard on 03-26-2010 03:51 AM

I can compile successfully, i changed the actual table names in my class to table, you will need to change on your side to tables in your org.



table = Account

field = AccountName 

Message Edited by RudiHulsbos on 03-26-2010 02:30 PM

Ah - suddenly the mists clear.


You are attempting to invoke the method from the Recruitement_Dashboard_Controller class - as the method is not static, it isn't available.