You need to sign in to do that
Don't have an account?
yogesh goad
Error: Compile Error: Invalid type: ReadResult at line 5 column 9
i get the following error while saving the below code in a apex class.
Error: Compile Error: Invalid type: ReadResult at line 5 column 9
Error: Compile Error: Invalid type: ReadResult at line 5 column 9
public with sharing class MetadataController { public void readCustomObjectSync() { try { ReadResult readResult = metadataConnection .readMetadata('CustomObject', new String[] { 'MyCustomObject1__c', 'MyCustomObject2__c' }); Metadata[] mdInfo = readResult.getRecords(); System.debug('Number of component info returned: ' + mdInfo.length); for (Metadata md : mdInfo) { if (md != null) { CustomObject obj = (CustomObject) md; System.debug('Custom object full name: ' + obj.getFullName()); System.debug('Label: ' + obj.getLabel()); System.debug('Number of custom fields: ' + obj.getFields().length); System.debug('Sharing model: ' + obj.getSharingModel()); } else { System.debug('Empty metadata.'); } } } catch (ConnectionException ce) { ce.printStackTrace(); } } }
Kindly confirm if the version is compliant of the above.
hey sonam,
thanks for the help.
i have already set the API to 32.0 in version setting.
i also created and saved a class with getDescribe() method (of the schema class) and its using API 32.0.