function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mark BrusoMark Bruso 

Export the Territory Assignment Rules stored in Territory2Rule and Territory2RuleItem?

Is it possible to Export the Territory Assignment Rules stored in Territory2Rule and Territory2RuleItem?
AnudeepAnudeep (Salesforce Developers) 
Hi Mark, 

I suggest retrieving Territory2Rule/Territory2RuleItem through Metadata API for assignment rules. See sample package.xml below. Territory2Rule components have the suffix territory2Rule and are stored in the rules folder under the folder for the corresponding Territory2Model.
 
<?xml version="1.0" encoding="UTF-8"?> 
<Package xmlns="http://soap.sforce.com/2006/04/metadata"> 
        <types> 
            <members>FY13</members>
            <members>FY14</members> 
            <name>Territory2Model</name> 
        </types>
        
        <types>
            <members>FY13.AccRule1</members>
            <members>FY14.AccRule1</members>
            <name>Territory2Rule</name>
        </types>
        
        <version>50.0</version>
</Package>