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
Prallavi DuaPrallavi Dua 

query all the Class methods from Apex class

Hi,
I am using SOQL query to retrive all the class methods,
SOQL query ========= "select id,name,Body from apexclass''

Can someone help me to retrive all the class methods and variables using SOQL
Thanks
 
D-CoderD-Coder
You cannot query apex class method names using SOQL.

Instead , get the apex class body. And apply some logic to find out method names.
For example.
1. If your method name has specific prefix or suffix - search that string
2. Search string '} G' ==> Global methods start with G
3. Search string '} P' ==> Public / private methods start with P
You can do this exercise using apex code and not using SOQL query.

If this answers your query please mark this question as a solved so that it can be filtered out from unsolved questions.
AvaneeshAvaneesh
Hi Prallavi Dua

you have two Option's to get the list of method and other information of your each class

1
select id , name , body from apexclass
// SOQL query
and u lots of logic to find your effective solution 

2
this is an easy way which I will recommend you 
Tooling API

u have to just write small code for authentication and then enjoy hit on google u will get a direct code for that 


I hope this was helpful for you

Thank you
Avaneesh Singh
AvaneeshAvaneesh
Hi 

if you want to go with the first solution then let me know I can hard code for you what ever u want 

 
Prallavi DuaPrallavi Dua
Hi Avaneesh,

Can you please help out with hard code
AvaneeshAvaneesh
Hi Prallavi 
Sure give me some time I will write hard code for you.
Prallavi DuaPrallavi Dua
Hi Avaneesh,
I am waiting for your hard cord.
Can u please help me in dat.

Thanks in Advance.

 
prakher jain 10prakher jain 10
Hello Can SomeOne help me I have written a class in which im querying apec classes i need to write test class for it can you help with it