Package Custom Metadata Types
- Package your custom metadata types.
- Package your types’ associated records.
- Upload your package.
- Install your package in a subscriber org.
- Upgrade your package.
When you’re ready to package up your custom metadata types and records, you can choose your own adventure. Managed packages, unmanaged packages, and managed package extensions are all compatible with custom metadata types. And change sets let you deploy your types and records from a sandbox.
Next, add your custom metadata type to the package.
- Click Add.
- For the component type, select Custom Metadata Type.
- Select Threat Tier.
- Click Add to Package.
Easy! Notice that your custom metadata type and its fields were added to the package, but your records are missing. Let’s take care of that next.
The process for adding custom metadata records to a package is almost the same as it is for packaging types. The only difference is that instead of selecting a standard option from the list of component types, you select your specific type. Let’s give it a try, starting from the package detail page.
- Click Add.
- For the component type, select Threat Tier.
- Select all your custom metadata records.
- Click Add to Package.
After you’ve added all your custom metadata types, records, and any other components your app needs, you’re ready to rock and roll. Uploading a package that contains custom metadata types and records isn’t any different from uploading other types of packages.
Click Upload on the package detail page to kick off the process. Set the version name to Spring 2016, and leave the Version Number as is.
Typically if you’re using a managed package, you want your first release to be beta. But we’re all about diving in, so let’s go straight for the big time. Select Managed - Released for the release type. If you’re using an unmanaged package, don’t worry about this part.
For more complex packages, you’ll probably have to spend some time fiddling with the other options on this page. But for now, just click Upload and wait for the process to complete.
When your upload is finished, you’ll receive an email with an installation link for your package. If you have another Developer Edition org, you can see for yourself the results of your fearless adventure into the world of meta. If not, you just have to take our word for it.
Make sure that you’re logged out of the org where you developed the package. Follow the link in the email, and log in to your alternate account. When prompted, install the app for admins only. When the installation completes, your app appears on the Installed Packages page.
But how do we know whether we successfully completed our journey?
In the Quick Find box, search for Custom Metadata Types. If all went as planned, you see your Threat Tier custom metadata type. That’s all well and good, but what you’re really interested in is whether your records migrated over.
Click Manage Records to see the magic for yourself.
Looks like the gang’s all here! You’ve successfully moved your app configuration records from one org to another in just a few easy steps.
Of course, our adventure isn’t over yet. App development is rarely a one-and-done process. Down the line, you’ll want to make improvements and fix your app.
Upgrading managed packages is where our earlier discussion about field manageability is especially important.
For example, we made our Account Tier field upgradeable. So as the package developer, you can change the Account Tier field and the values of this field on records in future iterations of the app. On the other hand, your subscriber orgs can’t make changes. They can create Threat Tier records, but not edit existing values.
Vacation is a subscriber editable field, so the subscriber org can change the field based on its own needs. Subscriber editable also means that you can’t overwrite your subscriber’s values through a package upgrade.
If you created a managed package, you can deploy an upgrade to see how this works. In your development org, make some changes to both the Account Tier and Vacation fields. Using the same process as before, upload your package and reinstall it in your subscriber org using the email link. Check the fields and records on the upgraded package. You can see the changes you made to the Account Tier field, but the Vacation field looks the same as it did before the upgrade.
You’ve made it to the last leg of the journey. Only one question remains: What do you do with all your existing app configurations now that you’ve found a better way?