function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
raSFUserraSFUser 

Custom Metadata fields

Hello i have toast messages that display to users based on diffrent rules, i need this test to be translatable / as well as allow overridable by system admins when the managed package is deployed.

I beleave Custom Metadata fields in conjunction with translation workbench will allow this but i have not idea how to retrieve the data in SOQL, could somone give me an example?

when i try the below all i get is an empty entry.

SELECT Label, ExampleNamespace__Ex_example_field__c FROM ExampleNamespace__Ex_example__mdt

 

Best Answer chosen by raSFUser
paul diracpaul dirac
Hi Ryan,
Consider custom settings as an alternative to your use case.
Check if your metadata is actually non-empty, go to your metadata, press Manage *your metadata name* and see if there is at least one row

All Answers

paul diracpaul dirac
Hi Ryan,
Consider custom settings as an alternative to your use case.
Check if your metadata is actually non-empty, go to your metadata, press Manage *your metadata name* and see if there is at least one row
This was selected as the best answer
raSFUserraSFUser
@paul dirac Thank you that was the problem, you mentioned custom settings are there any pros / cons to this?
 
paul diracpaul dirac

If you are interested there is an old post in stack exchange in which one of ex-salesforce engineer speaks abount custom setting and custom metadata in depht. Things changed over time but that post is still gold:
https://salesforce.stackexchange.com/questions/74049/what-is-the-difference-between-custom-settings-and-custom-metadata-types
In particular:

"Unfortunately, at this time, if you want to create a MAP of all of the values for a given Custom Metadata Type, you must query all records and then populate it through a loop, similar to how you would for a normal table. Unlike Custom Settings which have a getAll method to create a MAP for you."

I made an assumption about your use case (if that's not the case just don't read the post and keep CMT) since I had a similar task. In that case, after some meeting about which "tool" fits better,we opted for the custom setting solution.
yahab basyahab bas
Custom metadata types support the following custom field types.
Metadata Relationship
Checkbox
Date
Date and Time
Email
Number
Percent
Phone
Picklist
Text
Text Area
Text Area (Long)
URL
A subscriber to a managed package containing a custom metadata type can’t add their own fields to the custom type. Only the org that develops the type can add custom fields.  mod apk
Custom metadata type fields are manageable, which means that the developer of a type can decide who can change field values after they are deployed to a subscriber org. The Field Manageability options are.
Only the package developer (via package upgrade)—(Developer controlled) The developer of a record can change the value of the field by releasing a new version of the custom metadata package. The subscriber can’t change the value of the field.
Any user with the Customize Application permission (managed package upgrades won't overwrite the value)—(Subscriber-controlled) Anyone with the correct permissions can change the value of the field. First generation and second generation manage package upgrades don’t overwrite the value, however, second generation unlocked packages do overwrite the value.
No one—(Locked after release) For any record of the type, the value of the field is immutable after deployment, even on the developer org where the record was created.
Martin Luther 10Martin Luther 10
Custom Metadata field can be used by Yoast in Wordpress because i have used the Custom Metadata in one of my sites (https://apkguru.net/)and that is actually working great and better than I ever expected. 
king saputraking saputra
Custom metadata type fields are manageable, Gamemod (https://gamemod.co.id/) which means that the developer of a type can decide who can change field values after they are deployed to a subscriber org kuliahpendidikan (https://kuliahpendidikan.com/)
James MonroeJames Monroe
you can easily manage the meta type fields like in our website admin portal (https://ewora.net). Then you can use the yoast to create custom metadata.