Deploying Data as Part of a User Story

Updated 1 week ago by Copado Solutions

Introduction

Copado allows you to seamlessly deploy data across different environments in your pipeline by means of user stories. User stories are not just a simple way of moving changes across your pipeline; they also help you keep track of the changes over time and see who has made a change, where and when.

There are two ways of deploying data through a user story:

  • With data templates
  • Using data commits 

Let’s take a closer look at each of these options.

Data Commits

With data commits, you can keep a version history of the changes in a data set via CSV files and easily move commits to upper environments in your pipeline or back-promote commits to other lower environments. This functionality relies on data sets, which are CSV files that contain data snapshots taken from a given Salesforce org at a specific point in time.

Let’s see how the data commit process works.

  1. Navigate to an existing User Story record or create a new user story.
  2. Select the credential linked to the environment that contains the data changes and make sure it has been authenticated.

    To avoid deployment errors, make sure the user of the credential selected in the user story has access to all the objects and fields in the data template that Copado will use as the basis for the data set.
  3. Provide the specifications and any other relevant information.
  4. Once you are done, click on Commit Data:
Commit Data Button

  1. You will be taken to the User Story Data Commit page, where you need to select the data template you want to use as the basis for your data set, and provide a commit message. If you don’t have a data template yet, review the Data Templates article to create one:
    Data commit

On this page, you can also add parameters to filter the data by any of the fields available in the credential selected in the user story for a particular main object. 

By default, Copado applies any filters you have in the data template automatically. However, you can remove the existing filters or update them as required if you want to generate a specific set of data with certain criteria. For instance, if you’re going to commit products that belong to a particular product family, click on Add new parameter to specify this:

Data commit filters

These filters are only applied to this specific data set files generation and won’t override existing filters in your data template. If you want to go back to the original filter configuration, click on Reset Filters.

 

  1. Once you are done, click again on Commit Data. Copado will create a User Story Data Commit record that shows the message, the date and the status of your commit. If the commit is successful, Copado generates a data set with files based on the data template and the filters selected in the previous step.
    User Story Data Commit record

If the commit fails, the Data Commit record status is set to Completed with Errors and no data set files are generated:

User Story Data Commit record details

From the Data Commit record, you can easily navigate to:

  • The deployment job that triggered the creation of the data set files to troubleshoot any potential issues (this deployment record follows the naming convention Generate {US Name}/{Data Template Name}). The deployment step also shows the filters that have been applied to the data commit. 
  • The Data Set record that contains the new files or new version of the files.

Once the Data Commit record is created, Copado also creates a Data Template deployment task that points to the data set generated during the commit:

Data template deployment task

You should not remove the data set files or the Data Template deployment task generated during the commit. Doing so may cause your deployment to fail. Also, bear in mind that the data sets and the data deployment task are automatically removed if you remove the Data Commit record.
Important Considerations About Data Commits
  • If you create a new data commit using the same data template, Copado does not create a new data set; only one data set per template is created. Instead, Copado creates a new version of the files. 
  • Once a user story is promoted, if there are multiple versions of the files, Copado just deploys the latest version.
  • You can create multiple commits from different data templates in the same user story.

Data Template Deployment Task

You have seen how you can commit and deploy a specific version of your data with version control using data commits. But what if you just want to deploy data without creating a data set and keeping files with the changes? You can easily do that using a Data Template deployment task.

Let’s say you have a user story where you need to create five new products and their configuration. Once you have created the products, you can deploy them to other upper environments in your pipeline by adding a product data template to your user story in a user story deployment task.

Let’s take a look at the step-by-step process:

  1. Open your user story.
  2. Navigate to the Deployment Tasks related list and click on New.
  3. Give your deployment task a name and select Data Template from the Type drop-down menu.
  4. Select an option in the Perform Deployment Task picklist field. Deployment tasks can be executed before or after the Git Promotion step, depending on your needs. In this case, it doesn’t matter which option you choose since all you want to deploy is the product template.
  5. Select your product data template in the Data Template lookup field or create a new one if you don’t have one. Your task should look like this:

Data Template deployment task

  1. Click on Save.
  2. Since you want to deploy only the five products you have created as part of your user story, navigate to the Task Details section and click on the pencil icon in the Template Filter field to filter the template and just deploy the relevant data:

Pencil

Data filters confirmation screen

Copado only applies this filter to the deployment of that particular user story. If your product template has any other filters applied, those filters are not overridden except for that user story deployment. See the section below for more information on the deployment process.

Deploying Your User Story

You have seen how you can commit data to a user story leveraging data sets or add a data template as a user story deployment task. Now, let’s see what happens when you promote your user story.

When you promote and deploy your user story, Copado converts the Data Template deployment task you added to the user story or the one that Copado generated during the data commit into a Data Template deployment step and deploys it on its own or together with any other deployment steps if you have added other tasks or committed any metadata on the user story.

Data Template deployment step


How did we do?