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 a main object and its related parent and child objects. Please bear in mind that you should build one data template per object.
With this new 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 normally 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.
- Stop deployment on first issue: This option can be used if you want to make sure a deployment is 100% successful and want a full data deployment and not a partial deployment. If there is an issue with just one of the records, the deployment will stop.
- 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.
- 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 will be 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 will not be updated or removed.
- Upsert attachments: When this value is selected, Copado first checks if the attachments of the records that are being deployed already exist in the destination environment. If they do not exist, Copado will insert them.
- 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 will deploy the records and delete all the attachments. This will ensure that the records in the destination environment have no attachments at all.
- Match Owner: 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 a particular access or visibility and workflows or processes attached to them. In this case, you can check the Match Owner checkbox. If this option is not selected, the records will be automatically assigned to the user that executes the deployment.
- Match Record Type: If you are deploying data between orgs, you may want to ensure this 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 will be assigned the default record type in the profile of the deploying user.
Once you have added all the required information, flag the Active checkbox in the bottom left corner and click on Save Template.
In this tab, you will find all the fields included in the main object (except for lookup 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 still 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 the Salesforce’s external Id fields will 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 generate 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. There are fields that 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 will keep the same number of characters as in the original value but will replace the characters with random values.
- Scramble with Format: Copado will replace 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 will 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 new data template will be displayed:
When you click on Create new Data Template, Copado executes the following actions:
- Create the record behind the scenes:
- Assign the same master data org.
- Assign the row object as the main object.
- Autoselect all the fields.
- Check a Salesforce’s external Id field as the External Id field, if any.
- Add this item to the template picklist and autosselect it.
In this tab, you can see a list of the child objects that 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 will vary depending on the data type of the field selected:
Below you will find 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.
Importing/Exporting a Template
Once you have entered all the required parameters in a data template, you can save it and also export it:
If you have a data template file you would like to import into your Copado org, you can do so from the Data Templates tab. To import a data template, follow the steps below:
- From the Data Templates tab, select the All list view and then click on the Import Templates button to import the json file of a data template you previously exported or that has been shared with you:
Copado will then create the corresponding data template records and once the import process is completed, a list of imported templates (parent templates and related templates) will appear.
- At the bottom of the page, you will find the Template Source Org lookup field, and you will need to select the source org for the main template as well as all its related templates:
- If you want to activate the templates, flag the Active checkbox and click on Validate.
- You will be redirected to the Data Templates Import confirmation page. In this page you can review and open all the data templates created during the import.
- Click on the Finish Import button to exit this page and return to the Data Templates tab.
If a field selected in the template no longer exists in the template source org, or the template of a related object has been deleted or deactivated, a warning list with all the error messages will be displayed.