Hello and welcome.
My name is Mohith Shrivastava,
and I'm a Developer Evangelist here at Salesforce.
I'm super excited to show you a demo
on Programmatically Managed Communities
using SFDX and Experience Bundle.
In this demo, we will see
how to create communities programmatically
using Salesforce CLI.
We will use Experience Bundle
to modify communities metadata,
and retrieve modified metadata using Salesforce CLI.
We will make code changes using the VSCode editor
to the communities metadata
and push changes to scratch orgs using Salesforce CLI.
We will also show you how to publish communities
using Salesforce CLI.
For this demo, I'm using Salesforce CLI.
You can install the Salesforce CLI
from developer.salesforce.com/tools/sfdxcli.
You'll also need a Visual Studio Code editor.
We also have VS code plug in Salesforce extension
for VS code that makes it easy to work
with Salesforce DX projects.
Let's create an SFDX project.
To do that, I'm going to go to command line
and say SFDX create project.
Let's pick up the standard template here.
Let me name the project as
tdxDemocommunitiesALM.
So you can see the project scaffold here.
So I have the project scaffold.
Next thing I want to do is authorize my Dev Hub.
To do that, I'll go to the command palette
and choose authorize a Dev Hub.
So once authorized,
you will see a message card,
the authorization is successful.
Next step would be I'm going to create a scratch org
so that I can do my communities project development.
Before that, there is one thing
that you will have to note,
that is to update our scratch org definition file,
so that it has features like communities and sites.
To work with ExperienceBundle,
we will need to make sure that in our settings,
the ExperienceBundle is enabled.
You can easily do that in Scratch orgs
by using the settings,
ExperienceBundle settings
and enabling the ExperienceBundle metadata to true.
Also we need to make sure
that our scratch org is ready for communities project.
To do that,
I will have to enable the network
in my community settings.
So once I have all these,
I am ready to create a scratch org.
To create a scratch org,
all that I need to do is
go to the command palette and say SFDX,
and say create a defined scratch org.
I'm going to choose the project scratch definition file
that I have here.
And let me say tdxDemo as an alias for my org.
I'm going to retain the scratch org
for probably seven days.
You can create community using the UI,
or you can programmatically do it
through the SFDX CLI.
So let's explore some of the commands used
to manage communities project.
So all the communities command
you'll find under sfdx force:community,
and you can do a slash help on it.
As you can see the command line,
we have two different commands,
one for creation of the community,
the other one for the publishing or making it live.
Let's start by creating a community.
To do that, go to sfdX force:community:create.
And I can do a little help on it.
I can copy this straight away and create one.
going to copy this command,
just as it is.
So once I execute the command should see a message
that your communities being created.
Note that the process of creation
of community is asynchronous.
To make sure that our communities is ready,
we'll have to go to this URL that is specified here.
Okay, now the community is created.
Notice that it is in the previous state.
That means it's not been published.
You can use the experience builder,
to customize this community further.
Alright, now let's do some customizations
on this community using the experience builder.
Maybe I want to change the desktop of this button.
And maybe the color of the button.
Now let's go ahead and publish these changes
using the Salesforce CLI.
To publish the changes,
I'll type sfdx force:community:publish
and the name of the community.
In this case, the name of my community is
My Customer Community.
Notice that under experiences folder,
we have the community folder,
and then we have all the access that are required.
Let's say I want to change the label from my local.
I can push this change
using sfdx force:source:push:command.
Alright, looks like the pattern
of the label has changed as expected.
Note that if you have Experience Bundle enabled
in your non scratch orgs like production are developer,
you can retrieve the Experience Bundle using
source retrieve command.
And also you can deploy these Experience Bundle
using source deploy commands.
To learn more about Experience Bundle,
visit our developer documentation
around Lightning Communities Developer Guide.
Here, we will explain the Experience Bundle structure,
and also how to enable the Experience Bundle metadata type
in your scratch and non scratch orgs.
It also walks you through how to retrieve
and deploy Experience Bundle using metadata API.
Thank you so much for taking time
to watch this demo,
and I hope you're having a wonderful TDX20.