I have a scheduled class which needs to call to external WebService. Base on the WebService result - I'll need to run some logic - and call to additional update callout function.

Since the callout are not supported in scudeule classes - solution would be to use @future annotation.

The problem is that I can't tell when the first WebService function finish it's execution and I can't use it's output.

Is there any way call the WebService as well use its output result?

1 Answer 1


You'll have to do whatever DML you need to do in the future/queueable method that you call. You cannot perform a callout in a Schedulable class. That means your logic will look like this:

public void execute(SchedulableContext context) {
@future(callouts=true) public static void callWebService() {
  ... Do callout and DML ...

The future method will run after the Schedulable class' execute method, so there's no way your Schedulable class can use the results of your callout method.

  • Thanks, I was happier if I could avoid pushing DML objects, but as I see it I have no other option.
    – aralele
    Jun 18, 2018 at 6:55
  • @aralele Yes, that's correct. It's an unfortunate limit of the system, but that's the best you can do.
    – sfdcfox
    Jun 18, 2018 at 8:47

You must log in to answer this question.

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