Data Templates For Salesforce Lightning

Updated 1 week ago by Copado Solutions


A data template is a configuration file of the data structure you want to migrate between your Salesforce orgs. You can configure a data template for the main object, related parent, and child objects. We recommend that you build one data template per object.

Data templates let you migrate data configuration for complex applications such as CPQ or test data between your production orgs and sandboxes.

You can use data templates to seed test data and move data as metadata (i.e., CPQ). However, data templates are not a substitute for an ETL tool.
Create A New Data Template

Follow the steps below to create a new data template:

  1. Click the Salesforce App Launcher and launch the Data Template App.
  2. Click New and enter the Data Template Name and Description for your Data Template.
    - You may want to reference the name of the object for which you are building the template in this field.
    - Do not create a data template name with a period, as this will affect your data template import/export format.
    Example: Contact Data Template V 1.1.
  3. Click Save.
  4. Once you click Save, you’ll need to define the data template by configuring the template schema credential and the main object.
  5. Click Define Data Source to select your Template Schema Credential and the Main Object. You’ll see the following fields:
    Fields marked * are mandatory fields.
    • * Template Schema Credential: Credentials for the org containing the schema for the objects and fields you want to migrate. Often this is a sandbox org, but sometimes, it can also be a production org. We’ve listed some use cases for the type of orgs and the scenarios that they are commonly used in:
      • You’ll use the production org as the Template Schema Credential if:
        • You’re using the data template to seed data in a sandbox.
      • You’ll use a sandbox org as the Template Schema Credential if: 
        • If you’re developing a new product in a sandbox and want to move it forward, you would use a sandbox as Template Schema Credential.
        • A consultant creates a template to share it with a customer, so they don’t need to configure it from scratch.
      • * Main Object: Select the object for which you want to create the template. Once you have selected the object, Copado will retrieve and populate the list of fields under the selected object. 
  6. Once you click Save in the Define Data Source dialog, you’ll see the following screen:
Data Template Tabs and Fields Explained

The data template has multiple tabs that let you configure your data template:

  • Details
  • Object Fields
  • Parent Objects
  • Child Objects
  • Main Object Filter
  • Deployment Options
  • Relationship Diagram

Let’s learn about each tab in detail.


You can view or edit the Data Template Name and Description from the Details tab.

Object Fields 

From the Object Fields tab, you can view the list of fields under the Main Object of your data template. The object fields tab lets you select records in your data query.

  1. Click Edit to customize the Object Fields section.
- Fields that cannot be updated, such as lookup or master-detail fields, are not displayed under this list. 
- By default, all fields are checked, but you can uncheck them if you wish to. 
- If you deselect a required field, you’ll receive a warning message that the insert of the new records using this Data Template might fail as you’ve not selected a required field. You can continue with a deployment in scenarios where your users have workflow rules or triggers in the destination org, and doing so could add value to the required field.
Do not select roll-up summary or formula fields, as they are read-only fields, and read-only fields cannot be included in the data query.
  1. Select one field as External ID by checking the Use as External ID field.
    • You can select the Use as External ID field option only from Salesforce’s External ID fields. 
    • Copado uses Salesforce’s upsert method while deploying records. This method prevents duplicates by updating an existing record in the destination org using the External Id.
    • If you already have a value for the External Id fields in your records from the source org, select No Update from the drop-down menu.
      • Select Auto Generate For Empty Values from the drop-down menu if you don't have a value for the External ID and want Copado to generate one for you. 
      • Click Formula to build the formula Copado would use to create this value. Check out Automatic Record Matching for more information about this feature.
  2. Content Update field: This field is handy if you want to move data from your production to your sandbox environment. Some fields contain sensitive data, and you may not want to deploy them as is. In such a scenario, you can choose one of the following options:
    • Scramble Value: Copado keeps the same number of characters as in the original value and replaces the values of the characters with random values.
    • Scramble with Format: Copado replaces the numbers and letters in the original value, except for special characters.
    • Replace Value: Enter a random value, and Copado will replace the original value with it.
    Fields such as Email and Phone Number with fixed formats will only contain the Replace Value and Scramble with Format options under the drop-down list.
  3. Click Save once you’ve configured this tab.
Parent Objects

From the Parent Objects tab, you can view the list of parent objects. The list of parent objects is based on the lookup fields on the main object of the data template. The parent objects tab lets you select related records in your data query.

  1. To configure a Parent object, click Edit and select the parent object row.
  2. You’ll notice that the template picklist automatically appears next to the parent object you select. You can view the list of active templates for a parent object. You can create a new template if none are listed by clicking New.
  3. When you click Save, Copado will create the record behind the scenes and:
    1. Assign the object selected from a row as the main object.
    2. Assign the same Template Schema Credential org.
    3. Auto-Select all the fields.
    4. If there is a Salesforce external id field, it automatically checks it as an external id.
    5. Automatically activate the data template.
  4. Copado adds this item to the template picklist and auto-selects it.
  5. Click Save once you’ve configured this tab.

You can also select user lookup fields from this tab. Copado will try to match the user in the destination organization with the source user's email address. Copado will match this with the User Id during deployment if the email address field is not populated. 

Child Objects

In this tab, you’ll be able to view the child objects for the main object selected in your data template. 

  1. Like the Parent Objects tab, the template picklist automatically appears next to the child object you've selected. 
  2. You can view the list of active templates for a child object. You can create a new template if none are listed by clicking New
  3. Click Save once you’ve configured this tab. 
You will not see any child objects for a data template if you have created a data template on Copado Lightning and try to access the same via the Copado Salesforce Classic version. You’ll need to refresh the data template on the Copado Salesforce Classic page to fix the issue. 
Main Object Filter

The Main Object Filter tab lets you use an object field to filter your query. The operators vary based on the data type of the field you’ve selected.

  • Click the + Add new parameter button to build your custom filter. You can create a custom filter to select fields from a related parent object or use advanced operators like IN and NOT IN. This feature allows you to define a more granular query so that you can selectively deploy relevant records and avoid hitting the deployment limits. 
  • We’ve listed the fields and buttons along with their description below: 
    • + Add new parameter: click to create a new filter.
    • Filter Logic: the logic used in each of your filters during deployment. 
    • Max Record Limit: there is no default value set for this field. Leaving this field empty will set the limit to “Unlimited.”
    • Batch Size: the default batch size is 200. You can change the value for the default record size per transaction for a batch Apex job.
      Refer to the Copado Pro Query Tips section to learn how to create an advanced filter. 
  • Click Save once you’ve configured this tab.
You’ll get a warning message for an existing data template if you've configured the Main Object Filter using System fields (E.g., Created Date.)
Deployment Options

The deployment options tab lets you define the actions and rules that Copado needs to perform during the deployment.

  • We’ve listed the fields and buttons along with their description below: 
    • Continue on Error: specifies Copado when deployment should stop.
      • Continue deployment until blocker issue: this option is selected by default and is the default behavior if you do not select anything from the picklist. Your deployment will stop if there is a blocker issue.
        Example: The sandbox you are deploying to has reached the space limit.
  • Select Attachment Type: If you are deploying or updating attachments, you can specify the attachment type for the Salesforce View that you want to deploy to: 
    • Lightning files 
    • Classic attachments
Due to Salesforce limitations, Copado will not deploy attachments or files with a size larger than 50 MB. You’ll be able to view the list of all the files and attachments that were successfully deployed or failed from the Deployment Results page.
  • Attachment Actions: from this picklist field, you can choose how to deploy attachments. We’ve listed the picklist values and their impact: 
    • No attachments: this is the default value. Select this option to deploy records without attachments. 
    • Insert attachments: select this option to insert record attachments from your source environment to the destination environment. If a record in the destination environment has an attachment, Copado will not update or remove it. 
    • Replace attachments: selecting this value will first remove all attachments from records in the destination environment and deploy attachments from corresponding records in the source environment. 
    • Remove Attachments: use this value if your source environment contains records with attachments, and you want to deploy the records and delete all the attachments. This ensures that the records in the destination environment have no attachments at all. 
  • Match Owners: while deploying records to your sandbox, check this option if you want to ensure that the records you deploy have the same owner. If left unchecked, the records are automatically assigned to the user that executes the deployment.
    For Example, some record owners might have special access, visibility, workflows, or processes attached to their credentials. 
  • Match Record Type: If you are deploying data between orgs, you may want to ensure it is linked to its corresponding record type. If left unchecked or the record type doesn’t exist in the destination org, Copado will assign the default record type from the user profile used to deploy records.

Click Save once you’ve configured this tab.

Relationship Diagram

The relationship diagram tab provides a visual representation of the relationship between different objects selected in your data template. 

The relationship diagram is a Lightning component and won’t be available in Classic. You’ll need to set the visibility for this tab by enabling My Domain in your Salesforce Setup.
  • If you have a related template selected within your main template, you can skip navigating back to the related template to check the template details. 
  • The white rectangle represents the template that’s in use currently. You can also view: 
    • Filters or record limits applied in any of the templates
    • Attachment options that you’ve selected. You’ll notice a funnel or an attachment icon next to the template.
  • If you add or remove a related template, click Refresh Diagram.

Once you have configured and saved your Data Template, click Activate.

Activate and Deactivate a Data Template

Once you’ve configured the data template, you’ll need to go ahead and activate it. Doing so, renders your data template in the Deployment Wizard under the list of data templates available for deployment.

Activate a Data Template

Follow these steps to activate your data template:

  1. Click Activate from the top right.
  2. Click the Activate button.

You’ll notice that the Active checkbox in the highlights panel is checked.

Deactivate a Data Template

If you want to edit your data template or if you do not wish that your data template is available for deployments, you’ll need to deactivate it. Follow these steps to deactivate your data template:

  1. Navigate to the data template and click Deactivate. 
  1. Click the Deactivate button. 

You’ll notice that the Active checkbox next to the highlights panel disappears.

How did we do?