A data template is a configuration file that defines a data structure you want to migrate between Salesforce orgs. You can define a data template for the main object and its related parent and child objects. Please bear in mind that you should build one data template per object.
With this feature, you can migrate data configuration for complex applications such as CPQ or test data from your production orgs to your sandboxes.
Tabs and Fields
In this tab is where you enter the main details of your data template:
- Data Template Name: Give your data template a name. You may want to reference the name of the object for which you are building the template in this field.
- Template Source Org: This is the org that contains the records that you are going to move. This is usually a sandbox, but it can also be a production org. Take a look at the use cases below to decide which type of org your source org will be:
- If you are using the data template to seed data in a sandbox, the source org would usually be production.
- If you are developing a new product in a sandbox and want to move it forward, you would use a sandbox as source org.
- If a consultant is creating a template to share it with a customer so that they don’t need to configure it from scratch, the source org would be a sandbox as well.
- Main Object: Select the object for which you want to create the template. Once you have selected the object, Copado will retrieve the list of fields included in that object behind the scenes.
- Continue on Error: Specify at what point you would like the deployment to stop.
- Continue deployment until blocker issue: This is the default behavior. The deployment will only stop if there is a blocker issue, for instance, if the sandbox to which you are deploying has reached the limit, and there is no more space.
- Select Attachment Type: If you are deploying or updating attachments as part of your data template deployment, you can specify the type of attachment you want this action to be applied to, Lightning files or Classic attachments.Please note that due to a Salesforce limitation, attachments or files included in your data deployment with a size bigger than 50 MB will not be deployed. In the deployment results, you can find a list of all the deployed files and attachments, including those that did not get deployed due to this limitation.
- Attachment Actions: In this picklist field, you can select whether or not you want to deploy attachments as part of the data deployment. The possible options are the following:
- No attachments: This is the default value. If this option is selected, no attachments are deployed, even if the records that are being deployed have attachments.
- Insert attachments: When you select this value, Copado inserts the attachments from the source environment into the destination environment. Attachments that already exist in the destination are not updated or removed.
- Replace attachments: When this value is selected, Copado first removes all the attachments that are linked to the records in the destination environment and then deploys the attachments from the records in the source environment to the destination environment. This way, you make sure that the records in the destination environment only have the attachments from the source environment.
- Remove Attachments: If you select this option, Copado deploys the records and deletes all the attachments. This ensures that the records in the destination environment have no attachments at all.
- Match Owners: When you are deploying a record to a sandbox, you may want to ensure these records have the same owners, as these owners might have particular access or visibility and workflows or processes attached to them. In this case, you can check the Match Owners checkbox. If this option is not selected, the records are automatically assigned to the user that executes the deployment.
- Match Record Type: If you are deploying data between orgs, you may want to ensure the data is linked to the corresponding record type. If this option is not selected or the record type from the source org cannot be found in the destination, the data are assigned the default record type in the profile of the deploying user.
Once you have added all the required information, flag the Active checkbox at the bottom left corner and click on Save Template.
In this tab, you can find all the fields included in the main object (except for those fields that cannot be updated, such as lookup or master-detail fields) so that you can select those you want to include in your query. By default, all the fields are checked, but you can uncheck them as desired:
Please note that if you deselect a required field, a warning will be displayed to let you know that the insert of the new record might fail because it doesn’t have a required field, however, you can continue with the deployment even if a required field is not selected, as some users have workflow rules or triggers in the destination org that add a value to the required field:
Roll-up summary fields and formula fields must not be selected, as they are read-only fields and read-only fields cannot be included in the query.
Use as External ID: Select one field as External ID. Only Salesforce’s external Id fields have this option available. Copado uses Salesforce’s upsert method when deploying the records.
If you already have a value for the external Id fields in your records, you can select None in the drop-down menu next to the Use as External ID checkbox. If you don't have a value yet and want Copado to generate one for you, select Auto Generate For Empty Values. You will be prompted to build the formula that Copado will use to create this value (see the article Automatic Record Matching for more information about this feature):
Field Content Update: This column is very useful if you are moving data from production to a sandbox. Some fields contain sensitive data, and you may not want to deploy this data. In this case, you can choose any of the options below:
- Scramble Value: Copado keeps the same number of characters as in the original value and replaces the characters with random values.
- Scramble with Format: Copado replaces the numbers and letters of the original value, but not the special characters.
- Replace Value: Enter a random value, and Copado will replace the original value with it.
In this tab, you can see a list of the parent objects based on the lookup fields from the main object so that you can select the related records you want to include in the data query:
When selecting a row, the Template picklist appears in the Deployment Template column.
The template picklist lists active template records where the main object is the same as the row object. If there are none, a link to create a new data template will be displayed:
When you click on Create new Data Template, Copado executes the following actions:
- Copado creates the record behind the scenes:
- It assigns the row object as the main object.
- It assigns the same master data org.
- It assigns the same master data org.
- It autoselects all the fields.
- It checks a Salesforce’s external Id field as the external Id field, if any.
- Copado adds this item to the template picklist and autosselects it.
In this tab, you can also select user lookup fields. Upon deployment, Copado will try to match the user in the destination organization of your deployment using the user's email address or, if the email address doesn’t match, using the Id.
In this tab, you can see a list of the child objects you can select to include them in your data query. Like in the Parent Objects tab, when you select a row, the Template picklist appears. Available active template records will be displayed and, if there are none, you can click on Create new Data Template to create a new one. A template will be created behind the scenes and autoselected in the drop-down menu:
Main Object Filter
In this tab, you can use an object field to filter your query. The available operators may vary depending on the data type of the field selected:
You can also select Custom Filter to build a custom filter. This functionality enables you to use advanced filter scenarios like filtering by fields in a parent related object or using advanced operators like IN and NOT IN. This way, you can be more precise about which records to deploy and also avoid hitting deployment limits.
Below, you can see a description of the most relevant fields and buttons you can find in this tab:
Add new parameter: Click on this link to add a new filter row.
Filter Logic: This field shows the order in which the filters added will be applied.
Batch Size: The default batch size is 200, but you can edit this field and type in a different number.
Max Record Limit: This field doesn’t have a default value. If you don’t type in any number, it will be set to Unlimited.
For more information about the elements included in this tab, check out the Copado Pro Query Tips section.
The relationship diagram provides a visual representation of the relationship between the different objects included in your main template. You can open it by clicking on Show Relationship Diagram at the top right corner of your data template:
When you add a related template to your main template, you no longer need to navigate to this related template to check the details. In the relationship diagram, you can see all the related templates included in your main template and the relationship between the different objects:
As you can see in the screenshot above, the white box represents the template you are currently in. The relationship diagram also shows any filters or record limits applied in any of the templates or if any attachment options have been selected. If this is the case, a funnel or an attachment icon will be displayed next to the relevant template.
If you add or remove a related template, click on Refresh Diagram on the diagram page to get an overview of all the elements included in your template before you deploy it.