5

I am able to create a community and have a build-in sample community page deployed by executing sfdx force:source:push command and having the following definition file:

{
    "orgName": "Demo Company",
    "edition": "Developer",
    "features": ["Communities", "Sites"],
    "settings": {
        "orgPreferenceSettings" : {
            "s1DesktopEnabled": true,
            "networksEnabled": true
        }
    }
}

After push and running sfdx force:org:open -u SCRATCH_ALIAS I can view a sample page in a builder: SF builder screenshot

However I do not see a way to execute the publishing action (marked with red arrow in screenshot) via sfdx tool. I am thinking of trying to hack a curl command as a workaround, however I would prefer not to have to create a user and password for the scratch org, if it can be avoided (to me it seems a curl approach might be fragile solution).

Any tips are greatly welcome.

4
  • Community migration is a mix of deploying contents and manually enabling few things. Publish is one of those where you cannot automatically publish a community after migration but only manually. As far as I know, there's no support for this using CLI.
    – Jayant Das
    Commented Dec 5, 2018 at 13:54
  • Thank you Jayant Das. Could you provide me a list of the manual actions that are not supported via CLI?
    – Tuto
    Commented Dec 5, 2018 at 14:34
  • Take a look at the CLI reference, which provides a complete list of actions you can perform.
    – Jayant Das
    Commented Dec 5, 2018 at 14:37
  • Hi @Tuto is there any way we could contact. I am also fighting with deployment and work with SFDX and Community. I would be glad to talk a little. My email is [email protected] Commented Feb 21, 2020 at 6:32

2 Answers 2

2

Update & Working Solution 1-28-2021:

  • The Salesforce CLI now has "Community" command.

  • Some run asynchronously, but they work.

  • https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_community.htm

  • There is a Create and a Publish command you can use.

  • In our org, we use python to automate the scratch org creation.

  • It goes something like: Create community, wait 2 minutes, force:push -F (force), Publish, Create users and apply permission set. Then login as a community user.

    sfdx force:community:create --name "My Customer Community" --templatename "Customer Service" --urlpathprefix customers --description "My customer community" sfdx force:community:publish --name "My Customer Community"

1
  • after create the community by using sfdx, did you push all metadata ? or first push apex metata(like- Apexclasses,vfpages,aura,lwc,objects) only then community metadata(network,sitedotcom,navigationmenu,customsite & audiences)? if possible can you post all your community sfdx deployment process step wise.
    – sdandamud1
    Commented May 18, 2021 at 19:01
5

Community migration/deployment from sandbox to sandbox is a mix of automated and manual steps, be it either using Change Sets, Metadata API and I would assume the same to be using CLI. Referring to the Salesforce CLI Command Reference, there doesn't seem to be a way to Publish the community using any command.

If you refer to other links around Community deployment using say Change Sets or Metadata API, you will find that you will still need to perform quite a few manual steps, including Publishing the community once you have deployed your components. You can find some information around this topic on the below links:

3
  • Thank you @jayant-das for a complete answer. This knowledge might be invaluable when we decide if SF Communities are fit (at this moment) to be used in a CI/CD development model for large scale Enterprises.
    – Tuto
    Commented Dec 5, 2018 at 15:07
  • I would think from CI/CD process, it's still fit. However you still need to perform a post deployment step at times. And then as long as your components are not changing frequently, you don't need to "re-publish" your community with every CD, but only when you know there was a change with the deployment, you perform that post deployment step.
    – Jayant Das
    Commented Dec 5, 2018 at 15:46
  • I would prefer to start from a "clean" scratch org every time we do a CI testing cycle. It reduces impact of manual interventions and risk of "brown field" interference. Maybe it is possible to create Apex code that would do it for us, else we will probably resort to using curl commands or Selenium scripts for the task.
    – Tuto
    Commented Dec 5, 2018 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .