• Santosh Kumar Sriram 2323
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I have a flow called from a VFP that needs to utilize the Upload Files component in the flow. Since this component only works if the flow runs in Lightning Runtime, this has been enabled in our org. It turns out though, that any flow called from a VFP will by default render in Classic, EVEN IF Lightning Runtime is enabled.

I followed the directions in this document (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_flows_lightningruntime.htm) to create a Lightning Component extending Lightning Out with a dependency on lighting:flow. Then I updated the VFP to call this component and launch the flow. 

This did result in the flow seemingly to run in Lightning Runtime vs Classic (at least visually it did). Unfortunately, the upload file component still does not work, even with this solution in place. 

Does anyone have any idea how I can get this file upload component to function to work when called from a VFP in Lightning Runtime? I'm stumped. 

Code as its implemented now is below - I haven't set any of the finish behavior or outputs yet. 
<aura:application access="global" extends="ltng:outApp" >
    <aura:dependency resource="lightning:flow"/>
</aura:application>
<apex:page standardController="Stipulations__c" recordSetVar="stipulations">
   <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:LightningRuntime", function() {
               // Create the flow component and set the onstatuschange attribute
               $Lightning.createComponent("lightning:flow", {"onstatuschange":statusChange},
                  "flowContainer",
                  function (component) {
                     // Set the input variables
                     var inputVariables = [
                        {
                           name : 'inputOpptyId',
                           type : 'String',
                           value : "{!$CurrentPage.parameters.Id}"
                        }
                     ];
                     
                     // Start an interview in the flowContainer div, and 
                     // initializes the input variables.
                     component.startFlow("Stipulations_Submit_Documentation", inputVariables);
                  }
               );
            });
         </script>
      </body>
   </html>
</apex:page>