function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
D McGovernD McGovern 

Trouble with Flow on force.com Site

I was inspired by this post: https://goravseth.com/using-flows-as-a-form-tool-for-external-users, but I get an internal server error each time I try to acess the visualforce page from the code in that post. I have Communities enabled and it's pointing to an active Flow in my org. The steps I took:

  1. Create a Lightning application with provided code in dev console and save
  2. Create visualforce page with provided code in dev console, replace flow name with API name of active flow in my org
  3. Preview and get: An internal server error has occurred Error ID: 2107398568-65430 (-697475282)

First question: why isn't the following visualforce page working?
Lightning application copied:

<aura:application access="global" extends="ltng:outApp" implements="ltng:allowGuestAccess" >
    <aura:dependency resource="lightning:flow"/>
</aura:application>
Visualforce page:
<apex:page >
   <html>
      <head>
         <apex:includeLightning />
      </head>
      <body class="slds-scope">
         <div class="slds-scope">                                                 
         <div id="flowContainer" />
         <script>
            $Lightning.use("c:flowVF", function() {
               // Create the flow component and set the onstatuschange attribute
               $Lightning.createComponent("lightning:flow", {},
                  "flowContainer",
                  function (component) {
                     // Set the input variables                                      
                     // Start an interview in the flowContainer div, and 
                     // initializes the input variables.
                     component.startFlow("test_flow");
                  }
               );
            });
         </script>
         </div>
      </body>
   </html>
</apex:page>

Second attempt was to simply embed the flow on a basic visualforce page and try to make it look like Lightning:
<apex:page lightningStylesheets="true">
    <flow:interview name="test_flow"> </flow:interview>
</apex:page>
...it works great when I open the visualforce page. However, as soon as I switch to Sites:
  1. Lightning style is lost. I'm guessing that lightningstylesheets is something not accessible by a sites guest user, or something along those lines which is why the post I mention above goes through the hassle of creating a component?
  2. Flow doesn't find any records to display. It accepts an email address, looks for a Contact, and displays first name if found. When run via visualforce page directly it works great. When run on Sites, no return for first name. I'm guessing it's because the site Guest Profile doesn't have access to all Contacts, but I only see the option to grant Read and Create permissions, not View All. Is there another sharing/permission setting that I need to update? Where would I go for this?
So...
Ideally I can figure out why the lightning-styled flow via component in a vf page isn't working. Help? Even then, I wonder if I'll have the same trouble accessing all Contacts that I'm currently encountering in my Classic Flow, or if that's another reason for the component workaround.

Thanks for any suggestions.
D McGovernD McGovern
Partly figured it out. I needed to enable My Domain get the lightning component based Flow visible on the Site, but my Site user can now access Contacts to find the name. Good, although I'm curious what about enabling My Domain allows this.

However, I'm still stuck in Classic style on Sites but not on the VF page. Using the simple VF page with Stylesheets shows two white "Next" buttons while the component version just has one blue one. They both render exactly the same on a Site, though:
VF pages:
User-added image
User-added image
When viewed on Site:
User-added image

Is it possible to get Lightning style on a Site? What am I missing?
D McGovernD McGovern
Update: it started working. Maybe was a caching issue? I didn't make any changes.