3

We have several custom packages (SCM, Conga, FF). I've only ever used SOQL triggers for remote API use. We have a situation where a package action triggers several events across multiple packages. The "button action" inside VisualForce/SF does this by design. But now we need to trigger this button (persay) remotely. So here're my questions:

  1. How do I find the publicly explosed (API) methods in a package class?
  2. How can I find the methods/functions associated with a button?

Thanks a lot for any guidance on these sort of fundamentals. We're not SF experts, we're merely remoting in via SOAP to sync some platforms. So I just don't know where/how to approach source code inspection to work with poorly documented 3rd party packages. Thanks again!

3
  • Update: I've located the Apex Class by the name of the Controller in the VisualForce button designer. It has a list of methods! Hopefully I'm on to something. The method in question is: System.PageReference allocate() But that's all it says. Am I on the right track? Assuming I load the wsdl into SOAP for this Apex class.... How can I determine what params/properties are required? Commented Dec 8, 2014 at 18:11
  • 2
    You can only access global classes and methods inside of a managed package. Public methods are not accessible to you outside of the package.
    – greenstork
    Commented Dec 8, 2014 at 18:39
  • That's hopeful, thank you. It does indeed appear to be a global class according to the detail page. Commented Dec 8, 2014 at 19:30

1 Answer 1

2

If you have located a global Apex class within the managed package with the required global method and you are working via the SOAP API then anonymous Apex would be a good option.

Using the executeAnonymous method in either the Tooling or Apex APIs you can invoke the global method.

You call the method with a string containing the Apex to execute the method.

E.g. using some rough C#. You will need to replace PackageNamespace and PackageClass as required. The developer console would be a good place to test out the anonymous Apex first before writing the code against the SOAP API.

string anonApex = @"
    PackageNamespace.PackageClass pc = new PackageNamespace.PackageClass();
    PageReference pr = pc.allocate();
    System.debug(LoggingLevel.Error, pr);";

ToolingService toolingService = // create an instance of the ToolingService ...
ExecuteAnonymousResult result = toolingService.executeAnonymous(anonApex);

The trick will be if you want to extract some data from the resulting PageReference. There are two approaches I know of. Subvert an exception to return the required data or capture and process the resulting Apex Debug log.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .