community Commands

Use the community commands to create and publish a community, and view a list of available templates in you org.

force:community:create

Creates a community using a template.

Help for force:community:create

See "Which Community Template Should I Use?" in Salesforce Help for more information about the different template types.

When you execute this command, it creates the community in preview status, which means that it isn’t yet live. After you finish building your community, you can make it live.

If you have a Lightning community, publish the community using the sfdx force:community:publish command to make it live. If you have a Salesforce Tabs + Visualforce community, activate the community to make it live by updating the status field of the Network type in the Metadata API. Alternatively, in Experience Workspaces, go to Administration | Settings, and click Activate.

For Lightning communities, activating the community just sends out a welcome email to community members.

Examples:

1$ sfdx force:community:create --name "My Customer Community" --templatename "Customer Service" --urlpathprefix customers --description "My customer community"
1$ sfdx force:community:create -n partnercommunity -t "Partner Central" -p partners

Command Syntax

sfdx force:community:create
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-n NAME
-t TEMPLATENAME
-p URLPATHPREFIX
[-d DESCRIPTION]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-n | --name NAME
Required

The name of the community to create.

Type: string
-t | --templatename TEMPLATENAME
Required

The template to use to create the community, such as the Customer Service template. Run force:community:template:list to see which templates are available in your org.

Type: string
-p | --urlpathprefix URLPATHPREFIX
Required

The URL to append to the domain that you created when you enabled Communities for this org. For example, if your Communities domain name is UniversalTelco.force.com and you’re creating a customer community, enter "customers" to create the unique URL

UniversalTelco.force.com/customers.

Type: string
-d | --description DESCRIPTION
Optional

The description of the community. The description displays in All Communities in Setup and helps with community identification.

Type: string

force:community:publish

Publishes your Lightning community to make it live. Each time you publish it, you update the live community with the most recent updates.

Help for force:community:publish

When you publish a Lightning community for the first time, you make the community’s URL live and enable login access for community members.

Additionally, to send a welcome email to all community members, you must activate the Lightning community. (Activation is also required to successfully set up SEO for Lightning communities.) To activate a community, update the status field of the Network type in the Metadata API. Alternatively, in Experience Workspaces, go to Administration | Settings, and click Activate.

Subsequently, each time you publish the community, you update the live site with all changes made to the community since it was last published.

An email notification informs you when your changes are live.

Example:

1$ sfdx force:community:publish --name "My Customer Community"

Command Syntax

sfdx force:community:publish
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-n NAME

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-n | --name NAME
Required

The name of the Lightning community that you want to publish.

Type: string

force:community:template:list

Retrieves the list of templates available in your org for creating a community.

Help for force:community:template:list

See Which Community Template Should I Use? in Salesforce Help for more information about the different template types.

Example:

1$ sfdx force:community:template:list

Command Syntax

sfdx force:community:template:list
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string