I think that I am missing something small or then my whole logic is wrong with this. Here is the Lightning Component, that has been copied from a Salesforce Developer sites. https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_using_flow_cmp.htm
COMPONENT:
<aura:component implements="lightning:actionOverride,force:lightningQuickAction,force:hasRecordId,lightning:availableForFlowActions,lightning:availableForFlowScreens" access="global">
<aura:attribute name="AccountID" type="String" />
<aura:handler name="init" value="{!this}" action="{!c.init}" />
<div class="slds-box slds-theme_default slds-theme_backgroundColor-lightblue">
<lightning:flow aura:id="flowData" onstatuschange="{!c.handleStatusChange}"/>
</div>
</aura:component>
CONTROLLER:
({
init : function (component) {
// Find the component whose aura:id is "flowData"
var flow = component.find("flowData");
// In that component, start your flow. Reference the flow's API Name.
flow.startFlow("Account_Override");
},
handleStatusChange : function (component, event) {
if(event.getParam("status") === "FINISHED") {
var outputVariables = event.getParam("outputVariables");
var outputVar;
for (var i = 0; i < outputVariables.length; i++) {
outputVar = outputVariables[i];
if (outputVar.name === "redirect") {
var urlEvent = $A.get("e.force:navigateToSObject");
urlEvent.setParams({
"AccountID": outputVar.value,
"isredirect": "true"
});
urlEvent.fire();
}
}
}
}
})