Setting flow finish behavior without a custom controller

Until now, in order to redirect the user to a record created in a flow, you needed to embed the flow in a visualforce page, and use a custom apex controller to get the record Id from the flow so you can use pass it to a pagereference method and direct the user to the record.

This meant that you could not use lightning runtime (as flows embedded on visualforce pages will only use classic runtime) and that you needed to write up a custom controller.

No longer! With winter18, you can use the lightning flow component on a visualforce page - and that component automatically has access to flow variables via the outputVariables variable/property. (i have very limited js knowledge so please share the correct terminology).

Start with the sample code on developerforce.

It has a couple of issues and will not work as written, but a fine fellow who goes by Charles T on sfse guided me to a working proof-of-concept.

The two issues w the code as wrriten are

  1. the statusChange function will never be called.
  2. the provided structure of the for…in loop will pull the keys, not the values,

the ways to address this are documented in the answer

  1. add this property/parameter when you instantiate the flow component with lightning.createComponent : {"onstatuschange":statusChange}

  2. pull in the variable value using the key
    for (key in outputVariables){
    if outputVariables[key].name == 'vaOutput' {
    // make your decisions here


and you can watch a sample here :


Now read this

Deploying a Permission set for a Managed Package from Sandbox

WE have rolled out FinancialForce HCM, fka Vana HCM. In an rather conventional move, we did our development in a sandbox, and deployed our changes to production. Most of the deployment was regular run-of-the-mill workflows, a few custom... Continue →