Dynamically obtain a Flow Interview instance from within Apex - Ideas - Salesforce Trailblazer Community

All Ideas

Idea Details

Post an Idea
This idea has been delivered and can no longer be voted or commented on. If you’d like to add to this conversation, please post a new idea.
1,500  Points voting closed
Delivered in Spring 18
Delivered in Spring 18

Dynamically obtain a Flow Interview instance from within Apex

Apex & Visualforce

Use Case: Apex provides excellent support for calling Flow from within code. This provides an excellent way for admins to customise or extend Apex code behaviour without needing to ask a developer to open up the code, it provides "clicks not code application plugins". At present it is only possible to reference explicitly the desired Flow from Apex, thus it is not possible to build a packaged solution and have the subscriber configure (via a Custom Setting) which Flow the packaged code needs to invoke.

Apex Requirement: Please add a means to dynamically express and create the Flow instances either by extending Type.newInstance to support constructor parameters (would be nice generally to complete reflection support in Apex) or providing a new method such as Flow.Interview.newInstance(String flowName, Map<String, Object> params)

Examples of Requirement:
Flow.Interview.Interview dynamicInterview = Flow.Interview.newInstance('subsriberflow', packageParams);
dynamicInterview.start();
String outputValue = (String) dynamicInterview.getVariableValue('requestedOutputVariable)';
Or
Type dynamicInterviewType = Type.forName('Flow.Interview.' + subscriberFlowName);
Flow.Interview.Interview dynamicInterview = (Flow.Interview.Interview) dynamicInterviewType.newInstance(packageParams);
dynamicInterview.start();
String outputValue = (String) dynamicInterview.getVariableValue('requestedOutputVariable)';

 

· Flag

  • Upvotes
  • Downvotes

Ideas

Apps

from AppExchange

Questions

Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.



 

 

Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.

Salesforce takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.


 

Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.