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

Running Apex Code

I am trying to get my head around all the ways that you can run Apex code. I think I went off on wrong tangents reading about all the wonderful things that Apex Code can do, making some wrong assumptions about it. For example, I initially thought that I could run it directly in response to a button click without an intermediate s-control.

As near as I can tell, there are exactly two ways to cause Apex code to run:
  • As part of a trigger, either code directly in the body of the trigger or by calling class code, or
  • Through the Apex Web Services API, using the sforce.apex.execute method to call WebService type methods.
The second item allows use through s-controls (including the AJAX toolkit) and external applications using Java or .NET or whatever.

Is my understanding right? Are there any other ways to execute Apex Code?

You are correct, at least as of today.

Stay tuned.