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 Attachment
from the left-hand menu and again filter by parent object using EmailMessage.Attachments
.
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
. 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, those email-to-case records will be included (with attachments) into the target org.