InCountry logo
mobile-nav
Search
  • Products
    • Products
      • InCountry for Salesforce
      • Data Residency-as-a-Service
      • Alibaba Cloud InCountry Service
      • Compliance and security
    • Gateways
      • Email
      • Payment Vault
      • Web Forms
      • HTML
    • Developers
      • REST API
      • SDK
  • Solutions
    • Automotive
    • Energy
    • Financial services
    • Healthcare
    • Retail
    • Technology
    • Latest success story
      • IBM Consulting
  • Integrations
    • Cegid
    • Intertrust
    • MuleSoft
    • PayPal
    • Salesforce
    • ServiceNow
    • Stripe
    • Veeva Systems
    • Yandex
  • Resources
    • Country compliance
    • Documentation
    • Library
    • Partners
    • Pricing
  • About
    • News and Blog
    • Careers
    • Contact Us
    • FAQ
    • Leadership
  • Login
  • Schedule a Demo

›Administrator's guide

Home
  • InCountry Platform
Portal
  • Getting started
  • Documentation
    • Dashboard
    • Managing environments
    • Managing SDK credentials and services
    • Managing Border configuration
    • Managing payment vaults
    • Managing email gateways
    • Managing resident functions
    • Managing file imports
    • Managing profile and organization
    • Managing users
    • Managing encryption keys
  • Release notes
Border
  • Documentation
  • Release notes
REST API
  • Documentation
  • How to test CRUD requests through REST API
  • Release notes
POP API
  • Documentation
  • Release notes
Resident Functions
  • Documentation
Salesforce
  • About
  • Overview
  • Quick start guide for three-model package
  • Quick start guide for legacy package
  • Administrator's guide
    • Managing the package
    • Managing permissions
    • Managing OAuth2 authentication and authorization
    • Managing certificates
    • Registering CSP Trusted Sites
    • Managing InCountry Endpoints
    • Managing REST endpoints
    • Managing InCountry flags
    • Loading the application
    • Managing data regulation policies
    • Managing protected fields
    • Hashing the UserName field
    • Managing custom objects
    • Replacing standard elements
    • Configuring record search
    • Managing components
    • Managing web components
    • Setting up Salesforce Experience Cloud
    • Managing resident functions
    • Managing InCountry cache
    • Managing Apex triggers
    • Managing record synchronization
    • Managing web forms
    • Tracking changes to data regulation policies and regulated fields
    • Using formula fields
    • Using frontend validations
    • Using Email-to-Case feature
    • Debugging
    • Migrating data from one Salesforce organization to another
  • Developer’s guide
    • Apex SDK
    • JavaScript API
    • Retrieving record statistics
    • Tracking field history
  • User's guide
    • Working with protected fields
    • Sending compliant email messages
    • Importing data into Salesforce
    • Migrating records
    • Managing audit reports
    • Converting leads
    • Managing reports
    • FAQ
    • Release notes
Payment Vault
  • Documentation
BYOK
  • Documentation
FAQ
  • Get started with the platform
  • Integration options
  • Data regulation models
  • Limits and quotas
  • Video tutorials
Service Status
  • Status

Salesforce data migration between organizations

This documentation will help you migrate settings between Salesforce organizations. For example, from a Sandbox environment to a production one. First, you need to install the package on a working environment (Production).

After installing the InCountry package, follow the steps below:

  1. Navigate to Setup > Administration > Users > Permission Sets.

  2. Assign the InCountry User ,InCountry Admin and InCountry Community User permission sets to appropriate Salesforce users.

  3. Navigate to Setup > Settings > Identity > Identity Provider.

  4. Click Enable Identity Provider.

  5. Click Save.

  6. Navigate to Setup > Translation Language Settings.

  7. Click Enable.

note

To migrate metadata between Salesforce organizations, we can use Workbench (a manual Tool) or SFDX CLI commands.

Workbench (Tool)

The process of migrating data through Workbench is comprised of the following steps:

  • Retrieval of metadata

  • Deployment of metadata

Retrieving metadata

  1. Navigate to https://workbench.developerforce.com/login.php.

  2. Salesforce uses the concept of sandbox and production organizations. The sandbox has the test.salesfoece.com domain. Production has the login.salesforce.com domain.

  3. Choose the environment: Production or Sandbox.

  4. Check the I agree to the terms of service box.

  5. Click Login with Salesforce and fill in credentials for the Salesforce organization from which you want to migrate the settings.

  6. In the navigation menu, click Migration.

  7. Click Retrieve.

  8. Click Choose file.

  9. Select package.xml. The package.xml file will be populated with the following metadata from your organization:

    • Certificate

    • CspTrustedSite

    • CustomApplication

    • CustomLabels

    • CustomMetadata

    • CustomTab

    • FlexiPage

    • GlobalValueSet

    • GlobalValueSetTranslation

    • Layout

    • ListView

    • PermissionSet

    • PermissionSetGroup

    • RemoteSiteSetting

    • Report

    • ReportType

    • CustomField

    • CustomObject

    • CustomObjectTranslation

  10. Click Next.

  11. Click Retrieve.

  12. Once the status changes to Success, click Download ZIP File.

Deploying metadata

  1. Navigate to https://workbench.developerforce.com/login.php.

  2. Salesforce uses the concept of sandbox and production organizations. The sandbox has the test.salesfoece.com domain. Production has the login.salesforce.com domain.

  3. Choose the environment: Production or Sandbox.

  4. Check the I agree to the terms of service box.

  5. Click Login with Salesforce and enter credentials for the Salesforce organization to which you want to migrate the settings.

  6. In the navigation menu, click Migration.

  7. Click Deploy.

  8. Click Choose file and select the downloaded zip file.

  9. Check the Rollback On Error box.

  10. Click Next.

  11. Click Deploy.

  12. Once the status is updated to Success, the settings will migrate to a new organization.

After that, you need to fill records in our Custom Metadata type InCountryRestApiEndpoint .

  1. Navigate to Setup.

  2. Search for Certificate and Key Management. We can see all certificates which we have uploaded on the previous Salesforce organization.

  3. Click on gear in the upper right corner and click Setup in the dropdown menu.

  4. Search Custom Metadata Types.

  5. Click Manage Records opposite to InCountryRestApiEndpoint.

  6. Fill in certificate names in fields CertificateNameApi, CertificateNameBatch, CertificateNameRest, CertificateNameServerless for the right countries. The example illustrates the population of settings for Saudi Arabia.

    Settings

  7. Сheck the Endpoint box, change if necessary.

  8. Click Save.

Above we have described the steps for manual migration using third-party tools. Next, we will describe the steps using the tools provided by Salesforce. These tools are the SFDX cli commands.

SFDX CLI command

First, you need to download SFDX CLI and install https://developer.salesforce.com/tools/sfdxcli.

Retrieving metadata (via package.xml)

  1. Create an SFDX Project with the manifest file (from Webstorm for example) or open the terminal in the SFDX project folder.

  2. Find or create folder with name “manifest” in root SFDX project folder

  3. Copy package.xml file and paste(replace if it needed) in manifest folder

  4. The package.xml file will receive the following metadata from your organization:

    • Certificate

    • CspTrustedSite

    • CustomApplication

    • CustomLabels

    • CustomMetadata

    • CustomTab

    • FlexiPage

    • GlobalValueSet

    • GlobalValueSetTranslation

    • Layout

    • ListView

    • PermissionSet

    • PermissionSetGroup

    • RemoteSiteSetting

    • Report

    • ReportType

    • CustomField

    • CustomObject

    • CustomObjectTranslation

  5. Run sfdx auth:web:login --instanceurl https://login.salesforce.com. The instanceurl value can take https://test.salesforce.com (Sandbox) or a custom domain.

  6. Fill in credentials of the Salesforce organization from which you want to migrate the settings.

  7. Run sfdx force:source:retrieve -x manifest/package.xml -u username (from the organization which you want to migrate the settings).

Deploying metadata (via package.xml)

  1. Run sfdx auth:web:login --instanceurl https://login.salesforce.com. The instanceurl value can take (Sandbox) or custom domain.

  2. Fill in credentials of the Salesforce organization to which you want to migrate the settings.

  3. Run sfdx force:source:deploy -x manifest/package.xml -u username (to which you want to migrate settings).

Retrieving metadata (without package.xml)

  1. Create an SFDX Project with the manifest file (from Webstorm for example) or open the terminal in the SFDX project folder.

  2. Update the package.xml file in the manifest folder on our file.

  3. Run sfdx auth:web:login--instanceurl https://login.salesforce. The instanceurl value can take https://test.salesforce.com (Sandbox) or a custom domain.

  4. Fill in credentials of the Salesforce organization from which you want to migrate settings.

  5. The SFDX command will retrieve the following parameters:

    • Certificate

    • CspTrustedSite

    • CustomApplication

    • CustomLabels

    • CustomMetadata

    • CustomTab

    • FlexiPage

    • GlobalValueSet

    • GlobalValueSetTranslation

    • Layout

    • ListView

    • PermissionSet

    • PermissionSetGroup

    • RemoteSiteSetting

    • Report

    • ReportType

    • CustomField

    • CustomObject

    • CustomObjectTranslation

  6. Run

sfdx force:source:retrieve -m "Certificate, CspTrustedSite, CustomApplication, CustomLabels, CustomMetadata, CustomTab, FlexiPage, GlobalValueSet, GlobalValueSetTranslation, Layout, ListView, PermissionSet, PermissionSetGroup, RemoteSiteSetting, Report, ReportType, CustomField, CustomObject, CustomObjectTranslation" -u username (from organization from which you want to migrate the settings).

Deploying metadata (without package.xml)

  1. Run sfdx auth:web:login --instanceurl https://login.salesforce.com . The instanceurl value can take https://test.salesforce.com (Sandbox) or a custom domain.

  2. Fill in credentials of the Salesforce organization to which you want to migrate the settings.

  3. Run the following command:

sfdx force:source:deploy -m "Certificate, CspTrustedSite, CustomApplication, CustomLabels, CustomMetadata, CustomTab, FlexiPage, GlobalValueSet, GlobalValueSetTranslation, Layout, ListView, PermissionSet, PermissionSetGroup, RemoteSiteSetting, Report, ReportType, CustomField, CustomObject, CustomObjectTranslation" -u username (to which you want to migrate the settings).

After that, you need to fill records in our Custom Metadata type InCountryRestApiEndpoint.

  1. Navigate to Setup.

  2. Search Certificate and Key Management.

  3. We can see all certificates which we have on the previous Salesforce organization.

  4. Open in a new tab setup.

  5. Search Custom Metadata Types.

  6. Click Manage Records next to InCountryRestApiEndpoint.

  7. Fill in the certificate names in fields CertificateNameApi, CertificateNameBatch, CertificateNameRest, CertificateNameServerless for the right countries.

  8. Сheck the Endpoint field and change it if necessary.

  9. Click Save.

note

To migrate data between Salesforce organizations, we can use the Salesforce Inspector extension for Google Chrome or SFDX CLI Commands.

Below is an example of how to migrate Policy and PII Fields for a new Organization.

Salesforce Inspector extension for Google Chrome

First, you need to install the Salesforce Inspector extension for Google Chrome.

Retrieving PII fields Data

  1. Log in to the organization from which you want to migrate data.

  2. Click Salesforce Inspector.

    Salesforce Inspector

  3. Click Export Data.

  4. Paste the values below into the export query:

    select testIncountry1__IsCountryField__c, testIncountry1__Field_name__c, testIncountry1__IsLookup__c, testIncountry1__LookupRelationshipName__c, testIncountry1__LookupRequiredToSelectFields__c, testIncountry1__LookupObjectApiName__c, testIncountry1__NeedHash__c, testIncountry1__Object_name__c, testIncountry1__Reference_field__c, testIncountry1__Reference_order__c, testIncountry1__SearchKey__c, testIncountry1__Validation_strategy__c from testIncountry1__Object_relationship_fields__c
    
  5. Click Export. After that, you should get some result.

  6. Click Copy (CSV) in the Export result section.

Deploying PII fields Data

  1. Log in to the organization to which you want migrate data.

  2. Click Salesforce Inspector.

  3. Click Import Data.

  4. Choose the testIncountry1__Object_relationship_fields__c object.

  5. Select Format CSV and paste data.

    Deploying PII fields Data

  6. Click Import.

Once all records are imported successfully, data will be migrated to a new organization.

Retrieving Policy Data

  1. Log in to the organization from which you want to migrate data.

  2. Click Salesforce Inspector.

  3. Click Export Data.

  4. Paste the values below into the export query:

    select testIncountry1__Behavior__c, testIncountry1__Country__c, testIncountry1__Object_name__c, testIncountry1__Country_field__c, testIncountry1__CountryFieldValue__c, testIncountry1__Type__c from testIncountry1__Object_relationship__c
    
  5. Click Export. After that we are getting some result.

  6. Click Copy(CSV) in the Export result section.

Deploying Policy Data

  1. Log in to the organization to which you want to migrate data.

  2. Click Salesforce Inspector.

  3. Click Import Data.

  4. Choose the testIncountry1__Object_relationship__c object.

  5. Select Format CSV and paste data.

  6. Click Import.

Once all records are imported successfully, data will be migrated to a new organization.

SFDX CLI Commands

Retrieving PII fields Data

  1. Create an SFDX Project with the manifest file (from Webstorm for example) or open a terminal in the sfdx project folder.

  2. Run sfdx auth:web:login --instanceurl https://login.salesforce.com. The instanceurl value can take https://test.salesforce.com (Sandbox) or a custom domain.

  3. Fill in credentials for the Salesforce organization from which you want to migrate settings.

  4. Run the following command:

sfdx force:data:tree:export -u username (from orgatization from which to migrate the settings) --query "select testIncountry1__IsCountryField__c, testIncountry1__Field_name__c, testIncountry1__IsLookup__c, testIncountry1__LookupRelationshipName__c, testIncountry1__LookupRequiredToSelectFields__c, testIncountry1__LookupObjectApiName__c, testIncountry1__NeedHash__c, testIncountry1__Object_name__c, testIncountry1__Reference_field__c, testIncountry1__Reference_order__c, testIncountry1__SearchKey__c, testIncountry1__Validation_strategy__c from testIncountry1__Object_relationship_fields__c" --outputdir sfdx-out --plan

After that, the folder sfdx-out will appear in the project.

Deploying PII fields Data

  1. Run sfdx auth:web:login --instanceurl https://login.salesforce.com. The instanceurl value can take https://test.salesforce.com (Sandbox) or a custom domain.

  2. Fill in credentials for the Salesforce organization to which you want to migrate settings.

  3. Run the following command:

sfdx force:data:tree:import -u username (which to migrate the settings) --plan sfdx-out/testIncountry1__Object_relationship_fields__c-plan.json

Once all records are imported successfully, data will be migrated to a new organization.

Retrieving Policy Data

  1. Create an SFDX Project with the manifest file (from Webstorm for example) or open a terminal in the sfdx project folder.

  2. Run sfdx auth:web:login --instanceurl https:login.salesforce.com. The instanceurl value can take https://test.salesforce.com (Sandbox) or custom domain.

  3. Fill in credentials for the Salesforce organization from which you want to migrate settings.

  4. Run the following command:

sfdx force:data:tree:export -u username (from orgatization from which you want to migrate the settings) --query "select testIncountry1__Behavior__c, testIncountry1__Country__c, testIncountry1__Object_name__c, testIncountry1__Country_field__c, testIncountry1__CountryFieldValue__c, testIncountry1__Type__c from testIncountry1__Object_relationship__c" --outputdir sfdx-out --plan

After that, the folder sfdx-out will appear in the project.

Deploying Policy Data

  1. Run sfdx auth:web:login --instanceurl https:login.salesforce.com. The instanceurl value can take (Sandbox) or a custom domain.

  2. Fill in credentials for the Salesforce organization to which you want to migrate the settings.

  3. Run the following command:

sfdx force:data:tree:import -u username (to which you want to migrate the settings) --plan sfdx-out/testIncountry1__Object_relationship__c-plan.json

Once all records are imported successfully, data will be migrated to a new organization.

Package.xml

Download

← DebuggingApex SDK →
  • Workbench (Tool)
    • Retrieving metadata
    • Deploying metadata
  • SFDX CLI command
    • Retrieving metadata (via package.xml)
    • Deploying metadata (via package.xml)
    • Retrieving metadata (without package.xml)
    • Deploying metadata (without package.xml)
  • Salesforce Inspector extension for Google Chrome
    • Retrieving PII fields Data
    • Deploying PII fields Data
    • Retrieving Policy Data
    • Deploying Policy Data
  • SFDX CLI Commands
    • Retrieving PII fields Data
    • Deploying PII fields Data
    • Retrieving Policy Data
    • Deploying Policy Data
    • Package.xml
InCountry logo blue
© InCountry 2022.
All rights reserved. InCountry, Inc
  • PRIVACY POLICY
  • TERMS OF SERVICE
  • Social share
    • YouTube logo
    • Facebook logo
    • Twitter logo
    • LinkedIn
  • Column 1
    • Products
      • Products
        • InCountry for Salesforce
        • Data Residency-as-a-Service
        • Alibaba Cloud InCountry Service
        • Compliance and security
      • Gateways
        • Email
        • Payment Vault
        • Web Forms
        • HTML
      • Developers
        • REST API
        • SDK
  • Column 2
    • Solutions
      • Automotive
      • Energy
      • Financial services
      • Healthcare
      • Retail
      • Technology
    • Integrations
      • Cegid
      • Intertrust
      • MuleSoft
      • PayPal
      • Salesforce
      • ServiceNow
      • Stripe
      • Veeva Systems
      • Yandex
  • Column 3
    • Resources
      • Country compliance
      • Documentation
      • Library
      • Partners
      • Pricing
    • About
      • News and Blog
      • Careers
      • Contact Us
      • FAQ
      • Leadership