[SalesForce] How to deploy a lightning community alongwith its standard pages between orgs

We have a lightning community that is made up of standard pages(Blank standard pages). I want to deploy this community along with all its properties(most importantly pages) from one sandbox to other.

As per this question, we can do it by using metadata API(workbench). Can we do it using change sets? For metadata API I am getting all sorts of unfathomable errors.

Some of them are:

In field: Network – no Network named **** found

In field: Site – no CustomSite named *** found

Cannot find a user that matches any of the following usernames: (some user names); remove the user from the component being deployed or create a matching user in the destination organization.

This is the package XML I am using:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
     <types>
       <members>Landing Page Test</members>
       <name>Network</name>
    </types>
    <types>
       <members>Landing_Page_Test1</members>
       <name>SiteDotCom</name>
    </types>
    <types>
       <members>Landing_Page_Test</members>
       <name>CustomSite</name>
    </types>
    <version>45.0</version>
</Package>

I know as per this , we can deploy communities alongwith its pages. But this article doesn't describe the steps in detail(nor does any other SF documentation)

Using Change Sets

When I try to deploy it through change sets, I could find 'Network' and 'Site.com' as the components to be added in the list. Are these enough or anything more needs to be added? Also, when I went ahead with this and validated in target org I got error as:

enter image description here

More questions:

  1. What should be the value to be specified for tag in package.xml ? I am just adding the label of community now(which can be incorrect).

  2. Which one of SiteDotCom and CustomSite is the 'Sites' that we search in 'quick find' box in setup? And which salesforce entity does the other one represents?

Best Answer

I could achieve this using Metadata API via Workbench. Following is the major error that I received at first:

cannot find a user that matches any of the following usernames: abc@xyz.com, abc2@xyz.com; remove the user from the component being deployed or create a matching user in the destination organization.

To resolve this, we need to create/edit existing user to match the 2 usernames between target and source orgs. This resolved the issue.

I used following package.xml for deployment

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
     <types>
       <members>Landing Page Test</members>
       <name>Network</name>
    </types>
    <types>
       <members>Landing_Page_Test</members>
       <name>CustomSite</name>
    </types>
    <types>
       <members>Landing_Page_Test1</members>
       <name>SiteDotCom</name>
    </types>
    <version>45.0</version>
</Package>

What I am still unsure about this is that how to get value of 'SiteDotCom' type of component in my org(assuming that CustomSite is the one that we get after navigating to 'Sites' from setup). However, I was getting error during deployment as :

no SiteDotCom with name Landing_Page_Test1 found.

To which, I modified the package.xml to include it and it worked.