Find your content:

Search form

You are here

How to search through global methods of managed packages?

 
Share

You can see global methods in the managed package classes via Web UI. I have hundreds of managed package API classes that I need to search through by a keyword, to find a method that does what I need (or to know if there is even one like that).

Normally I run a full-text search of the Salesforce project in the IDE when I need to find something, but this does not work with managed classes, as their code in IDE is completely hidden, it's not even importing the global method definitions.

Any advice? I really would rather not spend hours opening each API class manually in the web UI whenever I need to find something.


Attribution to: Kirill Yunussov

Possible Suggestion/Solution #1

I have just been playing with the tooling API and discovered that it would be possible to retrieve the global method names for Apex classes within a managed package.

You could write a script that first queries all managed Apex classes (classes that have a namespace - there might be a better way to do this?):

https://SALESFORCE_DOMAIN_HERE/services/data/v28.0/tooling/query/q=SELECT+ID%2C+NamespacePrefix+FROM+ApexClass+WHERE+NamespacePrefix+%21%3D+null

And then retrieve the symbol table for each of these classes:

https://SALESFORCE_DOMAIN_HERE/services/data/v28.0/tooling/sobjects/ApexClass/CLASS_ID

Response will contain a symbol table with global method names/types, properties etc which should look something like:

...
"SymbolTable": {
    "constructors": [],
    "externalReferences": [],
    "innerClasses": [],
    "methods": [ 
        ...
    ],
    "namespace": "NS",
    "properties": [
        ...
    ]

You could parse this to output a nice list that could serve as the documentation you are after.

Sorry that I haven't pieced together all of the puzzle. If you think that you would like to continue down this path I can work with you towards a proper solution.


Attribution to: luke.mcfarlane
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33478

My Block Status

My Block Content