+ Start a Discussion
Thomas D.Thomas D. 

Lightning component with flow causing error

We are using a lightning component as quick action on a record, with a flow embedded in it. Now when someone open this quick action it sometimes give an error. Any help is appreciated. 

.cmp
<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" >
    <ltng:require styles="{!$Resource.modalCSS}" />
	<aura:handler name="init" value="{!this}" action="{!c.init}" />
    <lightning:flow aura:id="flowData" onstatuschange="{!c.handleStatusChange}" />
</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 Unique Name.
        var inputVariables = [
            { name : "recordId", type : "String", value: component.get("v.recordId") }
        ];
		// Start flow
        flow.startFlow("Teamwear_Internal_Flow",inputVariables);
    },
    handleStatusChange : function (component, event) {
        //Check if flow is finished
        if(event.getParam("status") === "FINISHED") {
            //redirect to record to force refresh
            var sobjectEvent=$A.get("e.force:navigateToSObject");
            sobjectEvent.setParams({
                "recordId": component.get("v.recordId")
            });
            sobjectEvent.fire();
        }
    }
})
Error:
lightning component with flow error

 
Shweta AlwaniShweta Alwani
Hi  Thomas D. 

Your error is not visible. Can you please write you error here in comment box.
Thomas D.Thomas D.
[Error in $A.getCallback() [Cannot read property 'generateUrl' of undefined]]
f()@https://xxx.lightning.force.com/components/force/navigationService.js:2:509
JayeeJayee
Hi Thomas
i think that you are reference null attribute on line 7:  component.get("v.recordId")
And i can't find any attributes state on a component.