certinia / apex-mdapi

Apex Wrapper for the Salesforce Metadata API
BSD 3-Clause "New" or "Revised" License
687 stars 976 forks source link

Read and create new Picklist do not work and I get Unknown Exception #239

Open udotheman opened 5 years ago

udotheman commented 5 years ago
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.

sukesh-kumar commented 4 years ago

Hi I'm facing the similar issue, where you able to get through this?