0

I'm trying to override the standard new button on Quote (only VF is an option available) in order to create a Quote with some predefined values on its fields. Wanted to use flow for the same and hence from the VF i'm starting a flow . In order to render the flow in Lightning Runtime I did exactly same as in this link . Now when the flow finishes I want to land directly on the newly created Quote record detail page for which I've code written in javascript to handle FINISH behavior.

           var statusChange = function (event) {
           if(event.getParam("status") === "FINISHED_SCREEN") {
              console.log('flow finished'); 
              var outputVariables = event.getParam("outputVariables");
              console.log('outputVariables --> '+outputVariables);
              var outputVar;
              for(var i = 0; i < outputVariables.length; i++) {
                  outputVar = outputVariables[i];
                  if(outputVar.name === "quoteId") {
                      console.log('should be here');
                      console.log('quote id--> '+outputVar.name + outputVar.value);
                      var urlEvent = $A.get("e.force:navigateToSObject");
                      urlEvent.setParams({
                          "recordId": outputVar.value,
                          "slideDevName": "detail"
                      });
                      urlEvent.fire();
                  }
              }
           }
        };

Problem is when I click the new button , quote is created and I see the screen with flow name and the statement that the flow has finished but I can't understand why the redirection isn't happening. All the log statements inside the IF condition were printed but the navigation is still not happening.

Can someone help me to point out what wrong i'm doing here?

PS - On the official documentation it is mentioned that

event.getParam("status") === "FINISHED"

It should be (verified through console log statements)

event.getParam("status") === "FINISHED_SCREEN"

1 Answer 1

0

Not sure if this qualifies as a proper answer but this is what i've done as a workaround - based on the Lightning Out Considerations. Because there is no one.app to listen to the standard events firing an event like navigateToSObject have no effect.

Modified code to make redirection work -

          if(event.getParam("status") === "FINISHED_SCREEN") {
               
              var outputVariables = event.getParam("outputVariables");
              
              var outputVar;
              for(var i = 0; i < outputVariables.length; i++) {
                  outputVar = outputVariables[i];
                  if(outputVar.name === "quoteId") {
                      window.parent.location ='/'+outputVar.value; 
                  }
              }
           }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .