The sample code for embedding a lightning flow component in a visualforce page includes a function that appears to be for handling the output variables from the flow component.
var statusChange = function (event) {
if(event.getParam("status") === "FINISHED") {
var outputVariables = event.getParam("outputVariables");
var outputVar;
for(outputVar in outputVariables) {
if(outputVar.name === "redirect") {
// Do something
}
}
}
};
However, I am unable to get this to function. I've added some simple logging within the function and am not seeing anything logged, indicating that the function is not being called at all.
var statusChange = function (event) {
console.log("fxn fired");
if(event.getParam("status") === "FINISHED") {
console.log("flow finished");
var outputVariables = event.getParam("outputVariables");
var outputVar;
for(outputVar in outputVariables) {
if(outputVar.name === "vaOutput") {
console.log("vaOutput found");
window.parent.location = '/' + event.getParams().vaOutput;
}
}
}
};
I'm guessing perhaps I need to add some (stuff) to my lightning app itself, as the sample in the documentation is just these 3 lines.
<aura:application access="global" extends="ltng:outApp" >
<aura:dependency resource="lightning:flow"/>
</aura:application>
Is there something missing from the code that would allow this to work? If it does, it would be most awesome, as we could handle flow output variables in visualforce without need for a custom apex controller.