You need to sign in to do that
Don't have an account?
Sennah
Callout from scheduled Apex not supported
Dear Product Manager in charge for the "Apex Scheduler",
I was wondering why my code did not worked when scheduled. After requesting the debug logs, I could see the following:
EXCEPTION_THROWN|[45,19]|System.CalloutException: Callout from scheduled Apex not supported.
Here are my questions:
1. Is this going to be officially changed?
2. Is there a workaround?
3. Did I missed something in the documentation or is it simply not written down there?
Quite disappointed,
Hannes
All Answers
Of course! Thanks for the hint.
I had that added in my Sandbox, but not deployed yet. Don't know what happened.
Best,
Hannes
Thanks for the hint, it helped!
FYI, that link is currently returning a page with the message below, I might be suffering from copy/paste failure, or maybe it's a temporary issue?
Heroku | No such app
There is no app configured at that hostname.
Perhaps the app owner has renamed it, or you mistyped the URL.
Anyway, for future googler's the design pattern below worked for me.
There are some design decisions that you'll need to make for yourself when using this. My test approach might not be necessary for your implementation, I included it as without it I was hitting the "System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out" error because the system.schedule() method runs "DML" on the CronTrigger table which blocks the callout.
I'm interested in more elegant solutions than the "if(! test.isRunningTes())" approach if anyone has any.