You need to sign in to do that
Don't have an account?
mysteriousaura
Insert records to a custom metadata type: Field is not writeable:
Hi,
I am trying to create records in a Custom MetaDataType using https://github.com/financialforcedev/apex-mdapi. But when I create a list to use a method CustomMetadataService.createMetadata I get an error Compile Error: Field is not writeable: NAMESPACE__TestRetention__mdt.DeveloperName at line 53
Here is my code
List< NAMESPACE__TestRetention__mdt > newList = new List< NAMESPACE__TestRetention__mdt >();
for(NAMESPACE__TestRetention__mdt s: newList)
{
s.developername='New';
s.label='New';
s.masterlabel='New';
s.qualifiedapiname='New';
newList.add(s);
}
CustomMetadataService.createMetadata(newlist);
How do I create data for inserting it into the method if I cant insert it to a list?
I am trying to create records in a Custom MetaDataType using https://github.com/financialforcedev/apex-mdapi. But when I create a list to use a method CustomMetadataService.createMetadata I get an error Compile Error: Field is not writeable: NAMESPACE__TestRetention__mdt.DeveloperName at line 53
Here is my code
List< NAMESPACE__TestRetention__mdt > newList = new List< NAMESPACE__TestRetention__mdt >();
for(NAMESPACE__TestRetention__mdt s: newList)
{
s.developername='New';
s.label='New';
s.masterlabel='New';
s.qualifiedapiname='New';
newList.add(s);
}
CustomMetadataService.createMetadata(newlist);
How do I create data for inserting it into the method if I cant insert it to a list?
Consider voting for Custom MetaData Types need APEX methods to access/update (https://success.salesforce.com/ideaView?id=0873A000000lD5pQAE)