I want to know if we can use batch jobs to call future methods (I want to insert users and that triggers a future method that assigns an Id to the user and manipulates a couple of fields) so I want to know if it is viable or not.


2 Answers 2


I have found a way to call a future method from a scheduled class but not batch class.It might help you : -

global class Scheduledbacthfuture Implements Schedulable{

    public Interface IScheduleDispached{
        void execute(SchedulableContext sc);

    global void execute(SchedulableContext sc){
        Type targetType = Type.forName('{HANDLERNAME');
        if(targetType != null){
            IScheduleDispached obj = (IScheduleDispached)targetType.newInstance();


public class {HANDLERNAME} implements Scheduledbacthfuture.IScheduleDispached {

  public void execute(SchedulableContext sc)
        //Call your Future Method Here


  • @Ishan, you can up-vote also, so that other can find it useful.
    – Avijit Das
    May 2, 2017 at 10:55
  • I am now getting an error which says FATAL_ERROR System.CalloutException: Callout from scheduled Apex not supported.
    – Ishan
    May 2, 2017 at 12:04
  • SO it works like, From Batch, you call scheduler and from scheduler, you call future. Its going one way inside the stack. Nov 20, 2017 at 9:50

You can not call future methods from batches. Actually batch and future both work in Async mode. For this case write one method which will check the request is coming from batch or not, if it is coming from a batch then call non-future method else call the future method.

For this purpose you can use System Class methods. eg.

//call non-future method
//call future method
  • Hi, @frodo I need to call the future method as it helps us fetch some important data without which user cannot do anything useful.
    – Ishan
    Apr 25, 2017 at 5:55
  • @Ishan Actually i'm just saying that the you would need to organize your code a little bit. The code which you have write in the future method needs to be written in non-future method, then on the basis of request type you can call this method from a future method or if it is coming from a batch then you can call it directly.
    – Mr.Frodo
    Apr 25, 2017 at 5:58
  • I don't think there is a way to implement callout without future method.
    – Ishan
    Apr 25, 2017 at 6:00
  • @ishan yes you can. If the request is coming from a batch, there is no need to write future method to make callout.
    – Mr.Frodo
    Apr 25, 2017 at 6:02
  • 1
    @Ishan see this answer
    – Mr.Frodo
    May 2, 2017 at 11:39

You must log in to answer this question.

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