SF Learners Hub


File upload using Button With Guest User

Share This Post

Here is the Steps to File Upload Using Button With Guest User.

Step 1: Install these Packages:

Step 2: Create a Screen Flow

  • Create Screen Element in the Screen Flow
  • Create Record Element in the Screen Flow
  • Create Apex Actions in the Screen Flow.
  • Click Save.
  • Click Activate.

Step 3: Create a Community Site or Experience Site.

Quick Find Box -> Sites -> Click New.

Step 4: Give the object access and field level access in the case object with read and create. Use the following Snapshot to give the field-level access.

Click the site -> Public Access Setting -> Search Case Object

Step 5: Click the Assigned User Button in the Profile.

Step 6: Click the Add Permission Set Button at the Bottom.

Step 7: Assign the File Upload Improved Permission set of this user.

Create an Aura Component

Step 8: Create Aura Component and Lightning Application. Use the below code:

Aura Component Bundle:

  • embedFlowInExternalWebsite.cmp
<aura:component  implements="flexipage:availableForAllPageTypes,lightning:availableForFlowActions" access="GLOBAL">
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    <lightning:flow aura:id="flowData"/>
  • embedFlowInExternalWebsiteController.js
    init : function (component) {
        var flow = component.find("flowData");

** replace the ‘YOUR_FLOW_API_NAME’ string with the name of the flow you want to run.

Create a Lightning Application

Lightning Application:

  • embedFlowInExternalWebsiteApp.app
<aura:application access="GLOBAL" extends="ltng:outApp" implements="ltng:allowGuestAccess">
    <aura:dependency resource="c:embedFlowInExternalWebsite"/> 

Step 9: Add your website’s domain to the CORS Allowed Origins List.

Quick Find Box -> CORS -> click New Button.

Step 10: Run this code:

<!DOCTYPE html>

<script src="https://curious-bear-q4ztlr-dev-ed.trailblaze.my.salesforce-sites.com/lightning/lightning.out.js"></script>

<div id="lightningLocator"></div>

        function() {
                { },                  
                function(cmp) {}


** Importantly here, you need to insert the URL to your Salesforce org in 2 places just before the /lightning/lightning.out.js.


I hope you like this blog and if you want any help let me know in the comment section.

Stay tuned, there is way more to come! Follow me on LinkedIn, Instagram, and Twitter. So you won’t miss out on all future articles.

One Response

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

The Power of Salesforce Integration

What You’ll Learn What Is Salesforce Integration? Salesforce integration involves combining the data and features of Salesforce with another application, creating a cohesive experience for