When changing the api version of the connection it doesn't use it when running anonymous apex.

Issue #887 resolved
Justin Julicher created an issue

In developer workbench when you select your version it will execute anonymous apex with the same version.

An example use case for this is clearing AsyncApexJobs that are stuck in queued status using System.abortAsyncJob(job.Id) which you can only do in API version 31, after this it gives you an error stating you must use the parent Id.

thanks.

Comments (2)

  1. Scott Wells repo owner

    Yeah, right now it's using the Apex SOAP API to execute anonymous Apex, and that means that it's using the SOAP API endpoint of the version for which the SOAP clients were generated. That's always the latest version in IC. That's actually true for the most part for interactions with the Salesforce APIs...it uses the latest API version. I'll keep this around to look into whether there's a way I can set an API version header or something to get it to use a per-request, client-specified API version.

  2. Scott Wells repo owner

    I never did find a way to set the API version under which anonymous Apex should be executed aside from changing the API version in the API endpoint URL, and that can be risky when using SOAP clients generated specifically from that API version's WSDLs. Resolving this as it's unlikely to change.

  3. Log in to comment