0

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"/>
</aura:application>

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

<apex:page >
 <html>
  <head>
     <apex:includeLightning />
  </head>
  <body class="slds-scope">
     <div id="flowContainer" />
     <script>
         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},
              "flowContainer",
              function (component) {
                 // Set the input variables


                 // Start an interview in the flowContainer div, and 
                 // initializes the input variables.
                 component.startFlow("Testing_In_Progress");
              }
           );
        });
     </script>
  </body>
</html>

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

3 Answers 3

2

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

1

Edit: Derp, this was a response to another answer and I posted in the wrong place, but.. whatever, hope this helps someone!

Not sure why your content won't render, but check your Guest Site User permissions, and try changing your flows properties to run in the system context without sharing.

Also, remove all Section components from your Screens to solve the navigation issue.

I've been getting that same exact error for two days, and after a lot of incremental testing I found that the Section component seemed to be the culprit.

1
  • I just confirmed this... Do you have a link to a known issue for this @nllpntr? Dec 21, 2021 at 10:03
0

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!

You must log in to answer this question.

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