
How to add LWC in Salesforce1 App for the community users.
Step 1: Create a new community
- Go to Setup and Enter “All Communities”
- Select All Communities
- Click on New Community
# After Creating Community make the following changes in the Administrator settings
1. Member settings
=> Provide access to a profile
2. Login setting
=> Allow internal user to login
3. Preference setting
=> Show all settings in Workspaces
Step 2: Create a lightning application
(a) Go to Developer Console
(b) Select File | New | Lightning Application
Add LWC component into the application
# Load the LWC component into the app.
— — — — — — — — CODE — — — — — — — —
<aura:application access=”GLOBAL” extends=”ltng:outApp”>
<aura:dependency resource=”lwcComponant Name”/>
</aura:application>
— — — — — — — — — — — — — — — — — —
Step 3: Create a new Visualforce page
(a) Go to Developer Console.
(b) Select File | New | Visualforce page
Add Lightning Application that we created on the previous step, into Visualforce page
# Load the lightning application into the page.
— — — — — — — — CODE — — — — — — — —
<apex:page >
<apex:includeLightning />
<div id=”lightning” />
<script>
$Lightning.use(“c:LightningApplication”, function() {
$Lightning.createComponent(“c:lwcComponant Name”, {
objectName: “Account”
},
“lightning”,
function(cmp) {
console.log(“LWC component was created”);
// do some stuff
}
);
});
</script>
</apex:page>
— — — — — — — — — — — — — — — — — -
Step 4: Create a Visualforce Tab
- Go to Setup and Enter “Tab”
- Search for Visualforce Tab and Click on New
# Add Visualforce Page into the tab.
Step 5: Provide the Visualforce access in Profile.
- Go to Setup and Select Profile
- Select customer Community User Profile
© Click on Enabled Visualforce Page Access
Step 6: Add the Visualforce tab into the community.
- Go to Setup and Select Communities which you had created
- Select Builder and Click on the top left corner
- Select Administration
- Select Tab
Conclusion
Salesforce mobile app doesn’t support LWC directly that’s why we need to first create a Visualforce tab and page and include that lWC component into it.
For more detail click here, http://bit.ly/2OQOqqy