I have a Flow wrapped in a simple Lightning Component that I use to override the standard "New" button on accounts. I'm running into a couple of issues with the user experience.
At the end of the Flow, I want the user to be redirected to the record they created (instead of looping back to the beginning of the flow). Or at the very least just close the window.
How do I add an "X" or close button to the pop up window so the user can cancel out at any time?
I know you can use the URL redirect in a custom button, or use visualforce, but this is using the standard button AND no vf.
Here's my component:
<aura:component implements="lightning:actionOverride,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<aura:handler name="init" value="{!this}" action="{!c.init}" />
<div aura:id="editDialog" role="dialog" tabindex="-1" aria-labelledby="header43" class="slds-modal slds-fade-in-open">
<div class="slds-modal__container">
<div class="slds-modal__header">
<h2 class="slds-text-heading--medium">New Record</h2>
</div>
<div class="slds-modal__content slds-p-around--large slds-grid slds-wrap ">
<lightning:flow aura:id="quickCreate" onstatuschange="{!c.handleStatusChange}" />
</div>
</div>
</div>
<div aura:id="overlay" class="slds-backdrop slds-backdrop--open"></div>
</aura:component>
Here's my controller:
({
init : function(component) {
//Find the component whose aura:id is "quickCreate"
var flow = component.find("quickCreate")
//In that component, start your flow. Reference the flow's API Name
flow.startFlow("Member_Quick_Create");
},
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({
"recordId": outputVar.value,
"isredirect": "true"
});
urlEvent.fire();
}
}
}
}
})
Any help would be appreciated!