Deploy Territories From One Org to Another Org of Salesforce (VS Code) : jayakrishnasfdc

Deploy Territories From One Org to Another Org of Salesforce (VS Code)
by: jayakrishnasfdc
blow post content copied from  Jayakrishna Ganjikunta
click here to view original post


We do not have option to deploy the territory managment from one salesforce org to another using changesets.

We have to use IDE tools like ANT, Eclipse etc.,

But using Visual Studio Code also we can able to do this easily.

Prerequisite: JDK, VS Code installed with Salesforce Extension Pack, Salesforce CLI. Follow the below articles to setup VS code
https://jayakrishnasfdc.wordpress.com/2018/12/15/salesforce-cli-installation-commands-configuration-and-advantages/
https://jayakrishnasfdc.wordpress.com/2018/12/16/salesforce-lightning-web-componentslwc/

Follow the below steps.

  • First, create the VS code project for Sandbox.
  • Open VS code, create a new project, Ctrl/⌘ -> Shift ->P, type  “Create Project with Manifest“.
Create Project with Manifest
  • Select the folder to save the project.
  • Now authorize the source org, using Authorize an Org command.
  • Now we need to retrieve the territory changes from the source org. Before that add the below code in your package.xml file.
  • Copy below Script and paste it in manifest folder -> package.xml

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?><Package xmlns=”http://soap.sforce.com/2006/04/metadata”> 
  <types>
        <members>*</members>
        <name>Territory2</name> 
   </types>    
<types>       
 <members>*</members>
        <name>Territory2Model</name>
    </types>
    <types>
         <members>*</members>
        <name>Territory2Rule</name>
    </types>
    <types> 
        <members>*</members>
       <name>Territory2Type</name>
    </types>
    <version>49.0</version>
</Package>

  • Right-click the manifest file and select “Retrieve Source in Manifest From Org“. wait till the changes are retrieved.
  • After successful retrieve, you will see below folders in your project.

  • Create a new VS code project for the destination Production (sandbox if needed).  Follow steps 1 through 4 to create a new project. Ignore if you already have one.
  • Now copy the folders and all theirs contents “territory2Models“, “territory2Types“.
  • Paste the copied folders into the destination project’s “default” folder.
  • Now its time to deploy. Please note that you need to deploy the “territory2Types” folder first. So right-click that folder and select “Deploy Source to org”.
  • Next, deploy the “territory2Models” folder. 

Now check in the destination org you should have the changes.


December 12, 2020 at 11:21AM
Click here for more details...

=============================
The original post is available in Jayakrishna Ganjikunta by jayakrishnasfdc
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce