Custom Metadata Type Records Using Static Methods
We have now new methods for Custom Metadata Types as like Custom Settings. by using these method we can remove the SOQL statement to get Custom Metadata Type Records.
before Sprint 21:-how we access the Custom Metadata Type records
list<Test_mdt> lstMetaDataRecords = [Select Id, MasterLabel from Test_mdt]
After Sprint 21:-how we access the Custom Metadata Type records ,
getAll() -Will return the all records from Custom Metadata Type.
Map<String, Test__mdt> mapMetaDataRecords = Test__mdt.getAll();
list<Test_mdt> lstMetaDataRecords = mapMetaDataRecords.values();
getInstance() – Will return a record from Custom Metadata Type.
Test_mdt objMetaDataRecord= Test_mdt.getInstance('test');