1

I have been trying to follow the Salesforce documentation, but running into errors such as "We can't execute this action. Ask your admin to check that the "c:OpportunityFinish" Lightning component's client-side controller includes an "invoke" method"

below is what I have so far:

cmp:

<aura:component access="global" implements="lightning:availableForFlowActions" >
    <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.
      flow.startFlow("CreateNextOpportunityFlowAction");
   },
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 === "newRecordId") {
            var urlEvent = $A.get("e.force:navigateToSObject");
            urlEvent.setParams({
               "recordId": outputVar.value,
               "isredirect": "true"
            });
            urlEvent.fire();
         }
      }
   }
}
})

When I have changed the "handleStatusChange" function to "invoke", it does run through without error, but it still does not redirect.

  • how are you running your component? – Himanshu Jan 16 at 5:32
  • I am in the same predicament. – Mossi Apr 9 at 22:23

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.