Use CLI to Deploy Changes from a Sandbox to Data Cloud

As a Salesforce developer, you can move your Data Cloud metadata and process definitions for Data Cloud features from one sandbox org to another sandbox org or to a production org. To accomplish this, you use a sandbox org that has Data Cloud enabled and provisioned. The feature metadata that you want to deploy must be added to a DevOps data kit. Once the metadata is in the data kit, you can retrieve it into a Salesforce DX project manifest. Finally, you can deploy the metadata to the production org. When you deploy changes from a sandbox, you can deploy them back to the production org or to another sandbox. This process involves multiple steps in both Data Cloud and the Salesforce Platform. Bookmark this page or keep it open in a separate window to refer to this topic.

For simplicity, this topic uses the term “production,” which can refer to the production org from which the sandbox was created or another sandbox org.

Make sure to complete these prerequisites before you create and start working on a Salesforce DX project.

  1. Open the VS Code editor and from the Command Palette, run SFDX: Create Project with Manifest. See Create Project.

  2. In the sfdx-project.json file, specify the login URL for the production org, which is https://login.salesforce.com.

  3. In the sfdx-project.json file, specify the login URL for the sandbox org, which is https://test.salesforce.com.

    Salesforce DX project JSON file for DevOps data kit

  1. Authorize the sandbox org and the production org to work with your Salesforce DX project. See Authorize your Production Org.
  1. Go to Data Cloud Setup and create a data space in the sandbox org and the production org. See Create a Data Space.

Note: In Data Cloud Setup, make sure that the data space with the same prefix name exists in both the sandbox org and the production org.

  1. In your sandbox org, go to Data Cloud Setup and create a data kit. See Create a Data Kit.
  2. For Data Kit Type, select DevOps.
  3. Add Data Cloud components that you want to deploy from the DevOps data kit and review the publishing sequence for these components. The components that you can add include data streams, data lake objects, calculated insights, and data graphs. See Data Cloud in a Sandbox.
  1. In your sandbox org, from Data Cloud Setup, click Data Kits.
  2. Select the DevOps data kit, and then click Download Manifest. The package.xml file that you downloaded contains all the metadata entities related to the DevOps data kit. Use this package.xml file in your Salesforce DX project to retrieve the data kit metadata.

Sample package.xml file for a data kit.

  1. To retrieve the DevOps data kit metadata into the sandbox org, run the sf project retrieve start --manifest manifest/package.xml command. After this command completes, you see new project folders that contain the data kit metadata. Consider uploading the entire project to GitHub or any other source control system. This practice helps with version control, collaboration, and ensures that your project is backed up and accessible to your team.

  2. Important:
    Don't skip this step

    Unix users, execute these commands to delete any key qualifier files related to the project.

    If you're a Windows user, search for key qualifier files in your project directory. Manually delete those files and their references from the project.

    Use Key Qualifier tag to remove files

  1. To start the deployment, run: sf project deploy start --manifest package.xml. See project deploy start.
  2. To check the deployment status, click Deployment History. After the data kit deploys in the production org, you can see the data kit, including all of its data stream bundles, data models, and calculated insights. All the metadata and process definitions from your sandbox org data kit are deployed in your production org. Consider uploading the entire project to GitHub or any other source control system. This practice helps with version control, collaboration, and ensures that your project is backed up and accessible to your team.

Review this information to resolve any deployment failures.

Missing FieldSrcTrgtRelationship Reference for DMO Relationship

This error occurs during deployment when you try to deploy Data Model Objects (DMOs) that have relationships defined, but the required FieldSrcTrgtRelationship metadata, which links the source and target fields of these relationships, is either missing or contains invalid references. Locate all XML files mentioned in the error within your SFDX project and manually delete those XML files. Then reattempt the deployment.

Missing FieldSrcTrgtRelationship Metadata

This error occurs when your deployment fails because a required FieldSrcTrgtRelationship definition can't be found.

To fix this, you need to retrieve the missing FieldSrcTrgtRelationship files from your source org. Here are two ways you can do it:

Option 1: Retrieve specific relationships using Org Browser

  1. In your SFDX project, open the Org Browser.
  2. Go to the Field Source Target Relationships folder.
  3. Find and retrieve only the specific relationship files mentioned in the error message. Retrieve relationship files

Option 2: Retrieve relationships using package.xml manifest file

  1. In your terminal, run the sf project retrieve start --manifest manifest/package.xml command to retrieve metadata.
  2. Open your package.xml file and add the missing FieldSrcTrgtRelationship names within the tag for FieldSrcTrgtRelationship. Example:
  1. If your project includes any key qualifier files related to these DMOs or relationships, make sure to delete them. [Refer to Step 6](#Retrieve the DevOps Data Kit Metadata)

  2. Now you can reattempt the deployment of your data kit to your target org.

Inactive Connectors After Deployment

This error occurs when your deployment completes, but some of the deployed connectors are in an inactive state in the target (production) org. While connection configurations are replicated, the sensitive authorization data is not copied during a sandbox refresh or certain deployment types.

To resolve inactive connector issues, you need to re-authorize them in the target (production) org.

  1. In your production org, go to Data Cloud and click Connectors.
  2. Identify connectors that show an Inactive status.
  3. Reauthorize the inactive connectors.
  4. Redeploy the data kit to ensure all components are correctly linked and operational.