0

I have a flow as described in the title, created with this feature. If I click on the 'Run' button i receive the following error:

The flow failed to start because the provided values were not valid: Scheduled Flow could only be run from a schedule

If i try with the following code:

Map<String, Object> params = new Map<String, Object>();
Flow.Interview.FlowName thisFlow = new Flow.Interview.FlowName(params);
thisFlow.start();

I receive the same error (as expected):

System.FlowException: The flow failed to start because the provided values were not valid: Scheduled Flow could only be run from a schedule

I also tried as suggested in this question, by making a class like so:

public class Flow_Scheduler implements Schedulable {

    public void execute(SchedulableContext sc) {
        Map<String, Object> params = new Map<String, Object>();
        Flow.Interview.Chargent_recurring_injector_for_scheduledBatchProcessing thisFlow = new Flow.Interview.Chargent_recurring_injector_for_scheduledBatchProcessing(params);
        thisFlow.start();
    }
}

and then launch it with:

System.schedule('my flow ' + String.valueOf(Datetime.now()), nextFireTime, new Flow_Scheduler());

and I receive the following:

The flow failed to start because the provided values were not valid: Scheduled Flow could only be run from a schedule

the same error message from the debug logs.

I need to run this flow with an "on-demand" fashion to make the testers job easier. What's the proper way to do this?

  • 1
    Unsure what constitutes "proper", but have you considered having two flows: one that does the work with the old start trigger, and one that has a scheduled start trigger which invokes the first flow? – MatthewGTS Dec 4 '19 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.