3

Before I understood the concept of Custom Metadata Types, we had a requirement in our application to store config data which rarely changes, and which is queryable. At that time, I chose to do this using Custom Objects, and created about 6 of these. I now have a better understanding of Custom Metadata Types, and would like to try using those for our configuration data instead of the Custom Objects. However, I don't want to start from scratch. So 2 questions.

  1. Is it possible, through hacking in Eclipse or using a tool someone has developed, to automatically create a Custom Metadata Type which has the same fields as a Custom Object?

  2. Is it possible, once Custom Metadata Types have been created which are analogs of Custom Objects (irrespective of the answer to the first question), to export the data from the Custom Objects and import them into the Custom Metadata Types? Do Custom Metadata Types have the concept of External IDs to allow child records to be inserted for a parent record?

2 Answers 2

3

I am not sure about the first question. You can explore that in Eclipse or other suitable tool. Otherwise, you need to create that manually.

Is it possible, once Custom Metadata Types have been created which are analogs of Custom Objects (irrespective of the answer to the first question), to export the data from the Custom Objects and import them into the Custom Metadata Types

Answer: "Yes". You can export the Custom object record and import the data into Custom Metadata types.

For this you need to use Custom Metadata Loader. I have used that. Refer Load or Update Records with the Custom Metadata Loader

Do Custom Metadata Types have the concept of External IDs to allow child records to be inserted for a parent record?

Ans: Custom Metadata types doesn't have concept of External IDs.

Through you can create "Metadata Relationship" between custom metadata types and create a validate rule on Child metadata type object to verify if Parent record exists as "Metadata Relationship".

3

You can convert a custom object xml file to a custom metadata xml file pretty easily:

  1. Change the file name to replace "__c" with "__mdt"
  2. Remove any parts of the file (sharing, in development, etc) that don't apply to custom metadata
  3. Add an "IsProtected" element to the type...this should be "true" if you want the type to be protected, "false" otherwise (doesn't matter if you're not going to make a managed package)
  4. Add "Manageability" elements to each field. If you're not going to make a managed package, it doesn't matter which option you pick for the value here--I'd just go for "Upgradeable".

Santanu is correct about the Custom Metadata loader.

We don't yet support external IDs.

2
  • Thanks Avrom, will give it a try - good to get the answer straight from the horse's mouth! For metadata loading child records, can we use the SFDC Id for the parent records, as we can with data loading objects?
    – hamayoun
    Mar 29, 2017 at 20:30
  • No, you have to use the name. It's a metadata deploy under the covers. So you're right, there is an extra step for deploying the records. Mar 29, 2017 at 22:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .