Deploying Email-to-Case records

This article describes how to deploy email-to-case records. Deploying Cases with attached emails.

Quinn Kuiper avatar
Written by Quinn Kuiper
Updated over a week ago

Prerequisites:

In the target Salesforce org, Email-To-Case and Email Drafts for Cases must be enabled.

From the left-hand menu in Gearset, select Configure and deploy under Data Deployments and select the source and target org from your list of linked orgs.

In this example, the case is in my Production org and I want to deploy it to my UAT org for testing.

Attachments from the emails can also be deployed with the email if required.

Once in the Configure data deployment menu, first select Case in the menu on the left-hand side and if required, add a field to the filter, to select the cases you want to deploy.

Next, to deploy the linked emails, EmailMessage needs to be selected. Tick the checkbox filter by parent object and change it to Case.Emails. In the reference fields to deploy, make sure RelatedToId is checked.

If email attachments are also needed, select ContentDocumentLink from the left-hand menu and again filter by parent object using EmailMessage.ContentDocumentLinks.

Once all the objects have been selected click next.

Here we need to make sure the EmailMessage has its deployment method set to Create new records. We also must include the ContentDocument and ContentVersion as related objects if deploying attachments. All the other related objects are optional. Select Next to proceed.

You can set any masking options as well as disabling and validation rules, triggers and flows on the following screens. Then run the data deployment.

Once the deployment has completed, we can check to see if the case has been deployed successfully.

Going into the email we can see that the attachments have also been deployed.

Did this answer your question?