Newer Version Available
CustomMetadataValue Class
Namespace
Usage
Use Metadata.CustomMetadataValue to access values for custom fields of custom metadata records.
Supported Apex primitive types are:
- Boolean
- Date
- DateTime
- Decimal
- Double
- Integer
- Long
- String
Example
1// Set a custom field value for a custom metadata record
2Metadata.CustomMetadataValue customField = new Metadata.CustomMetadataValue();
3customField.field = 'CustomField1__c';
4customField.value = 'New Value';
5customMetadata.values.add(customField);CustomMetadataValue Properties
The following are properties for CustomMetadataValue.
value
Signature
public Object value {get; set;}
Property Value
Type: Object
When setting the value for relationship fields, use the qualified API name of the related metadata, not the ID.
For more information, see Primitive Data Types.