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
harisripadmini vharisripadmini v 

How to access the fields of symbol table programmatically?

Using symbol table am able to fetch fields, external references etc of apex class. But, what if I want to access external references that are obtained from symbol table...
Can anyone suggest a way to do this
Raj VakatiRaj Vakati
You need to use tooling API 

You can extract the SymbolTable (https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_symboltable.htm) from the field with the same name on ApexClassMember (https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_apexclassmember.htm) or ApexTriggerMember. The externalReferences are directly accessible from the SymbolTable.

Refer this link

https://github.com/afawcett/apex-toolingapi

https://salesforce.stackexchange.com/questions/116165/symbol-table-from-apex-class
 
ToolingAPIWSDL.SforceService toolingService = new ToolingAPIWSDL.SforceService();
toolingService.SessionHeader = new ToolingAPIWSDL.SessionHeader_element();
toolingService.SessionHeader.SessionId = UserInfo.getSessionId();
toolingService.endpoint_x = URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/T/33.0';

ToolingAPIWSDL.QueryResult result = toolingService.query('select Id, Name from ApexClass WHERE Id = \'01p28000005irLNAAY\'');
for(ToolingAPIWSDL.sObject_x acx : result.records) {
    System.debug(acx);
}

 
harisripadmini vharisripadmini v
@Raj 
Thank you for the response!!

am retrieving symbol table for different classes.. Now, I need to fetch the external references of each class (Individual class) separately, Is there any chance of doing so using SymbolTable..