I have a flow that has some components that can only run on lightning runtime. I want to make this flow publicly accessible on some webpage. Hence I created a lightning app by going to the developer console. Here is the code for that:

<aura:application access="global" extends="ltng:outApp" >
   <aura:dependency resource="lightning:flow"/>

Then I went to the visualforce page and added the following code: the flow API name is Testing_In_Progress.

<apex:page >
     <apex:includeLightning />
  <body class="slds-scope">
     <div id="flowContainer" />
         var statusChange = function (event) {
           if(event.getParam("status") === "FINISHED") {
              // Control what happens when the interview finishes

              var outputVariables = event.getParam("outputVariables");
              var key;
              for(key in outputVariables) {
                 if(outputVariables[key].name === "myOutput") {
                    // Do something with an output variable
        $Lightning.use("c:lightningOutApp", function() {
           // Create the flow component and set the onstatuschange attribute
           $Lightning.createComponent("lightning:flow", {"onstatuschange":statusChange},
              function (component) {
                 // Set the input variables

                 // Start an interview in the flowContainer div, and 
                 // initializes the input variables.

When I run the flow, it gives me internal server error. I don't know what's wrong. Please help.


You should replace lightningOutApp with the name of your Aura App, otherwise, the code looks correct!


I have a similar setup as Anonymous mentioned in the original question. The flow renders the "Next" button, however, the content of the screen of the embedded flow is not shown. Also, when I click on "Next" button following error is thrown -

This page has an error. You might just need to refresh it. Action failed: flowruntime:flowRuntimeV2$controller$onActionSelected [Cannot read property 'get' of null] Failing descriptor: {flowruntime:flowRuntimeV2$controller$onActionSelected

Since, the error message is very generic I am not sure what is the exact problem. I tested the Visualforce setup with another screen-flow where everything worked completely fine. The flow that I am planning to embed is quite complex and also has links to sub-flows.

Any ideas?

Note - I need to use Visualforce page only as I need to collect the client IP address and pass it to the flow. Auth.SessionManagement.getCurrentSession().get('SourceIp'); method gives the client IP but only for authenticated users. And I want to expose the flow to public site. That's the reason I am using Visualforce pages only.

Thanks in advance!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.