0

I create a Lightning Aura Component with Lightning Event. Please see follow code.

<aura:component >
     <aura:attribute access="global" name="flowName" type="String" />
     <aura:attribute access="global" name="inputVariables" type="Object[]" default="[]" />
     <aura:registerEvent access="global" name="onStatusChanged" type="c:LightningFlowStatusChangedEvent"/>
     <aura:handler name="init" value="{!this}" action="{!c.init}"/>
     <lightning:flow aura:id="flowComponent" onstatuschange="{!c.statusChange}"/></aura:component>

In Visualforce page I use $Lightning.createComponent to create this component.

Code as follow

    var handleFlowStatusChange = function(event) { 
        var status = event.getParam("status");
        switch(status) { 
            case "FINISHED": 
                handleFlowStatusChangeCore(event);                        
                break;
            case "FINISHED_SCREEN":
                handleFlowStatusChangeCore(event);
                break;
            case "STARTED":
                // 
                break;
            case "PAUSED":
                // Handle Flow Paused.
                break;
            case "ERROR":
                handleFlowErrorCore(event);                       
                break;
        }
    };          
    $Lightning.use("c:LightningFlowApp", function() { 
       $Lightning.createComponent("c:LightningFlowComponent", {"flowName":flow.ApiName, "inputVariables": flow.inputVariables , "onStatusChanged": handleFlowStatusChange},
          "flow-component-container"
       );                   
    });

But when I test my code I already get this error

"Error in $A.getCallback() [The provided key (function(event) { var status = event.getParam("status"); switch(status) { case "FINISHED": handleFlowStatusChangeCore(event);
break; case "FINISHED_SCREEN": handleFlowStatusChangeCore(event); break; case "STARTED": // break; case "PAUSED": // Handle Flow Paused. break; case "ERROR": handleFlowErrorCore(event);
break; } }) is not a string and cannot be used to look up values for the current component.]"

Please share your idea how to fixed this issue.

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.