Error
Web service callout failed: WebService returned a SOAP Fault: 'text' is not a valid value for the enum 'FieldType' faultcode=soapenv:Client
Code
List<MetadataService.Metadata> customfieldList = new List<MetadataService.Metadata>();
for(integer i=1;i<stringCSVRecords.size();i++){
MetadataService.CustomField customField = new MetadataService.CustomField();
string[] splitRecords = stringCSVRecords[i].split(',');
customField.fullName = splitRecords[0]+'__c.'+splitRecords[1]+'__c';
System.debug('Custom Field Full Name'+' '+customField.fullName);
customField.label = splitRecords[1];
customField.type_x = splitRecords[2]; // text is provided in the csv file and retrieve here
customField.length = 42;
customfieldList.add(customField);
}
/* custom Fields are finally created by the same method createMetadat Here */
List<MetadataService.SaveResult> fieldsCreated = service.createMetadata(customfieldList);