I have a use case where I plan to use Custom Metadata Types. I would create multiple custom metadata types, each one looking up to its master. First the base product, then product/family, where one extends the other.

For example:

Base Product (base_product.mdt), includes two records: Container Name Folder Name

Industry Vertical (industry_vertical.mdt), includes two records:: Industry Container (Extends Base Container) Industry Folder (Extends Base Folder) Using Metadata Relationship

Then I create two custom objects, one that holds containers and one that holds folders. This is where the customer's use begins, creating content from one of the two types referred above.

The user would create records in these custom objects via our interface, which upon "New" asks what "Type" from my custom metadata, then provides the user with the default screen layout for the corresponding custom object, with the ID from the metadata type stored in a parent_id for reference.

It is my understanding custom metadata types are a good candidate for this requirement, because each time I create a new product, the package can simply add new types and I can rely on the data to be there without needing to write/maintain a clumsy post-install script.

The only drawback I see is that I cannot do the lookup from custom object to custom metadata type w/o apex/visualforce.

So my questions are:

  1. Is Custom Metadata Type the best choice for my (types) scenario?
  2. Is is true that a Custom Object cannot natively (declaratively) use a Custom Metadata Type for lookup?
  3. If #2 is true, is it on the roadmap?
  4. If I proceed with this design, will I run into issues, and if so any examples?

I am sorry if my questions sound silly, but I really want to leverage the platform and its features in the right manner, for the right scenario.

Thank you in advance!

  • #2 is definitely TRUE
    – cropredy
    Dec 21, 2016 at 2:17

1 Answer 1

  1. Here's the way I suggest thinking about this decision: Who's going to be creating/editing these, admins or business users? If the answer is "admins" you probably want a custom metadata type; if the answer is "business users" you want a custom object.
  2. This is, alas, true at this point. A text field containing a namespace-qualified* API name is the only real way to refer to a custom metadata type from a regular custom object.
  3. Yes (forward-looking statement alert!). But not in the really short term as of now. And as always with these types of things, don't make purchasing decisions based on it happening at all.
  4. The API name trick works pretty well as long as you don't change the name of your records (you can still change the label) and don't subsequently add a namespace to your organization (if your org is already namespaced, just include the namespace in your API names). If that might be an issue, you might have to update the reference manually.

*If you've developed the type, and your org doesn't have a namespace, this is just the name.

  • Thank you, I definitely only intend for the custom interface to update these types. I was able to easily access these types via apex, so with your confirmation I am going to continue down this path. Thanks for the quick help! Dec 21, 2016 at 19:52

You must log in to answer this question.

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