All Collections
Data Backup
Backing up Specific Metadata
Backup support for Custom Metadata Types ("__mdt" objects)
Backup support for Custom Metadata Types ("__mdt" objects)

How data backup jobs back up Custom Metadata Types, and how best to monitor changes

Alex Walter avatar
Written by Alex Walter
Updated over a week ago

For Custom Metadata Type records we treat these as metadata rather than data for data backup jobs. This means that the information stored for a Custom Metadata Type record is stored as part of the metadata snapshot rather than in the other objects you may see like Account, and Opportunity.

Changes to Custom Metadata types will not be shown in the New/Changed/Deleted within your backup job, but you will be able to see changes if you go to Use snapshot then Restore snapshot metadata for a backup run previous to any changes.

If you would like to see the details of the changes and be notified of them, we recommend that you set up a Monitoring job for the Custom metadata (details below).

Example

I have a Custom metadata type called DemoType which has two fields: a text label DemoGroup and a checkbox IsPublic:

This initially has 4 types: DreamforceDemo, Internal Dev Demo, InternalDemo, WebinarDemo.

There are some changes made:

- An Internal Sales Demo type was added

- Internal Dev Demo has the DemoGroup changed from "Developers at Gearset" to "Developers and Ops at Gearset"

- The WebinarDemo type was deleted

I then run my data backup job, but no changes are picked up. However, if I click on Restore snapshot metadata for the backup run before this change happened:

This will run a comparison of the metadata for with the backup run before the changes occurred, and I can see it picked up:


- The change for Internal Dev Demo

- The deleted WebinarDemo which exists in the backup, but does not exist in the org, so is shown in New items

- The newly added Internal_Sales_Demo which did not exist in the old backup run but exists in the org

If I want to restore the WebinarDemo , I select the item and click next:

I can then add some notes, and deploy this back to the org:

Once you click Deploy Now we will push the change to your org. Once deployed it will show you the results:

Finally, the deleted type WebinarDemo is restored back to your Salesforce org:

Creating a Metadata Monitoring Job

The recommended way of monitoring changes for metadata like Custom metadata types is to set up a Monitoring job in Gearset. Go to https://app.gearset.com/change-alerts or Monitoring in the sidebar, under Automation:

Click ADD NEW JOB... to bring up the dialog. We can select Custom metadata in the Metadata filter:

Using the same example as above, we note that the changes to the DemoType is picked up as "Different":

If we View History we can see the changes made are picked up as Changed / New / Deleted items:

We can View Comparison to see more details:

- We see the change to Internal Dev Demo under Changed Items

- The newly added Internal Sales Demo type is under New Items

- The deleted WebinarDemo type appears under Deleted Items

If you would like to revert these changes you can kick off a Roll back comparison by clicking View History, then clicking Rollback

This will then start a comparison with the saved Metadata backup and your org:

You can then deploy any changes back to your org in the same way as described above.

If you have any further questions, get in contact with the team via the chat!

Did this answer your question?