2

I have searched all around but cannot find out why My Lightning Action button seems to execute twice. It executes a flow which creates a record and then redirects to a visualforce page. But the issue is that it creates 2 copies of the new record... I know that the "Init" function can get called multiple times if not implemented correctly... What am I doing wrong here?

Lightning Component:

<aura:component access="global" implements="force:lightningQuickAction,force:hasRecordId" > <aura:handler name="init" value="{!this}" action="{!c.init}" /> <lightning:flow aura:id="flowData" onstatuschange="{!c.handleStatusChange}" /> </aura:component>

Controller:

({
init : function (component) {
    console.log('init component ...');
    var flow = component.find("flowData");
    var inputvars = [{ name : "recordId", type : "String", value: component.get("v.recordId") }];
    flow.startFlow("New_Quote_Flow",inputvars);
},
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 === "QuoteId") {
            var urlEvent = $A.get("e.force:navigateToURL");
            urlEvent.setParams({
               "url": "/apex/zqu__EditQuoteProducts?Id="+outputVar.value,
               "isredirect": "true"
            });
            urlEvent.fire();
         }
      }
   }
}

})

This is my Lightning Action definition, if it helps:

  • Doesn't anyone have some info on this? – Brian Hopkins Jun 11 '18 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.