0

All I want to do is launch my flow from APEX so ultimately I can schedule it. Everywhere else seems to be doing something more complicated with VF pages. Here's my code below.

public class FlowController {

    public Flow.Interview.RenewalOpptyGenerationFlow myFlow {get; set;}

    public void start() {
        Flow.Interview.RenewalOpptyGenerationFlow myFlow;
        myFlow.start();
        String outputValue = (String) myFlow.getVariableValue('newOpportunityList');
        System.debug(newOpportunityList);
    }
}
  • If you're new to apex, try some of the Developer Trailheads. They're an excellent way to get accustomed to the platform. – battery.cord Oct 24 '16 at 14:17
4

As this recent question illustrated, you need to instantiate the flow:

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

Also see Calling Flow from Apex for more explanation.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.