Update Custom Metadata Types using Metadata Api
With the introduction of Custom Metadata Types , the use of Custom Settings have been marginally reduced. Custom Metadata Types gives more flexibility in context of creating/maintaining Metadata, however when it comes to the point of updating Custom Metadata Types it involves some manual steps to be done from the Admin side which is a bit pain! With the help of Metadata Api this process can be made more simple just by writing some Apex. Lets go ahead and put some code to make use of Metadata Api and update Custom Metadata Types. Step 1: Create a new Custom Metadata Type "US_States" with one custom field "State__c". Step 2: Create few records for the above Custom Metadata Type using "Manage" button. Step 3: When we say that we update Custom Metadata Types using Metadata Api, behind the scenes it does an actual deployment and we use below class to track those deployment results. Create an Apex class "CustomMetadataCallback.apxc" u...