Use Metadata.CustomMetadataValue to access values for custom fields of custom metadata records.
// Set a custom field value for a custom metadata record Metadata.CustomMetadataValue customField = new Metadata.CustomMetadataValue(); customField.field = 'CustomField1__c'; customField.value = 'New Value'; customMetadata.values.add(customField);
The following are properties for CustomMetadataValue.
public Object value {get; set;}
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.