function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lynn  M GrandeLynn M Grande 

Error: Compile Error: Constructor not defined when initiating a flow from scheduled apex

When I try to call a flow from apex, i get an error. I am not sure if there is an issue with the flow or how i am calling it.
global  class scheduleUpdateAccountTeamwithDSM implements Schedulable{

   global void execute(SchedulableContext ctx) 
   {
         startFlow();
   }
    public void startFlow()
    {

        Flow.Interview.myFlow startFlow= new Flow.Interview.myFlow ();
        startFlow.start();        
    }
}
James LoghryJames Loghry
Lynn,

Even though you aren't passing a variable into your flow, you still need to pass an empty map into the constructor.  Try the following instead:
 
Flow.Interview.myFlow startFlow= new Flow.Interview.myFlow(new Map<String, Object>());

See the following post for a better example: http://andyinthecloud.com/2014/10/26/calling-flow-from-apex/