MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
List<MetadataService.CustomField> customFields = new List<MetadataService.CustomField>();
MetadataService.CustomField customField = new MetadataService.CustomField();
customField.fullName = Account.Language__c;
customField.label = 'Language';
customField.type_x = 'Picklist';
MetadataService.ValueSet picklistValueSet = new MetadataService.ValueSet();
MetadataService.ValueSetValuesDefinition valueDefinition = new MetadataService.ValueSetValuesDefinition();
List<MetadataService.CustomValue> values = new List<MetadataService.CustomValue>();
MetadataService.CustomField customFieldValues = (MetadataService.CustomField) service.readMetadata('CustomField', new String[] { 'Account.Language__c' }).getRecords()[0];
The last line creates the following error: System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 1367819446-359894 (-1213452598) faultcode=sf:UNKNOWN_EXCEPTION faultactor=
When I do the same in an other dev org it works fine. The picklist values are not restricted or in a global value set.
The last line creates the following error: System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 1367819446-359894 (-1213452598) faultcode=sf:UNKNOWN_EXCEPTION faultactor=
When I do the same in an other dev org it works fine. The picklist values are not restricted or in a global value set.