Employ Validation Rule Formulas with Custom Metadata Types (Pilot)
If you use validation rules, you know how helpful they can be, but
you have to hard code some of the values. Now you can store values you previously had to hard
code in custom metadata types and reference them in your validation rules.
Example
Use a validation rule formula to limit discounts on certain brands to 10%. You can use validation rules without custom metadata. However, to change an amount, you must update the hardcoded value. If you have multiple validation rules that check the discount amount, you have to manage all of them. Instead, use a validation rule formula with custom metadata types.
- Create a custom metadata type. In this example, we named it DiscountLimits.
- Create a custom field for your type. We named it maxDiscount.
- Create a record. We named it FoodDiscount.
$CustomMetadata.CustomMetadataTypeAPIName.RecordAPIName.FieldAPIName
Discount > $CustomMetadata.DiscountLimits__mdt.FoodDiscount.maxDiscount__c