6

I can submit an ApexExecutionOverlayAction GET request using REST API and I get an ID in response. But how do I use the ID? How can I see the ApexExecutionOverlayResult for my ApexExecutionOverlayAction request?

I wish SFDC had better documentation for the Tooling API.

2

You will need to execute the Apex Class/Trigger in question to hit the checkpoint. You must have the Apex Code log level set to Finer or Finest.

From Setting Checkpoints in Apex Code:

Important

To use checkpoints, the Apex Log Level must be set to Finer or Finest. See Setting Logging Levels.


Retrieving the results:

There doesn't currently appear to be any direct queryable relationship between a ApexExecutionOverlayResult and the ApexExecutionOverlayAction that caused it.

You could probably use a combination of Namespace, ClassName, Line and UserId to retrieve a ApexExecutionOverlayResult for the associated ApexExecutionOverlayAction. Since you can only have one checkpoint per line this should return a unique result. Note that some of these fields don't appear in the online documentation, but you can query them.

| improve this answer | |
  • I was looking at ways to get the ApexExecutionOverLayResult via Tooling API. I tried executing the Apex Class and then trying to query the ApexExecutionOverLayResult, but I didn't find a way to do it using the ApexExecutionOverLayRequest ID. – prashanthkr Sep 3 '14 at 5:10
0

The below is working for me using the workbench.

POST /services/data/v38.0/tooling/sobjects/ApexExecutionOverlayAction

{
"ActionScript" : "SELECT Id FROM Account WHERE Id = '001[ACCOUNT-ID]'",
"ActionScriptType" : "SOQL",
"ExecutableEntityId" : "01p[CLASS_ID]",
"IsDumpingHeap" : "true",
"Iteration" : "1",
"Line" : "29",
"ScopeId" : "005[USER-ID]"
}

Or if you want to run Apex, it looks like this

{
"ActionScript" : "System.debug('Todd overlays'); System.debug([SELECT Id FROM Account WHERE Id = '001[ACCOUNT-ID]']);",
"ActionScriptType" : "Apex",
"ExecutableEntityId" : "01p[CLASS_ID]",
"IsDumpingHeap" : "true",
"Iteration" : "1",
"Line" : "29",
"ScopeId" : "005[USER-ID]"
}

That returns me an ID like 1doe00000000123 (not a real ID) I will probably need that later.

But for now, I need the result ID. Here's a basic query you can use:
GET /services/data/v38.0/tooling/query/?q=SELECT+Id+FROM+ApexExecutionOverlayResult+ORDER+BY+CreatedDate+DESC+LIMIT+1

That gets me an ID such as 07ne00000001234 (not a real ID). Then the details are available at
GET /services/data/v38.0/tooling/sobjects/ApexExecutionOverlayResult/07ne00000001234

When I do Apex rather than SOQL I wish I could get at instance variable values but it's not impossible to recreate them.

Two other notes.

  1. If I don't specify an expiration date I get a default of 30 mins in the future
  2. You can only have one Action for a give class and line. So if you need to alter it, delete your old one with:
    DELETE /services/data/v38.0/tooling/sobjects/ApexExecutionOverlayAction/1doe00000000123
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.