1

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);

1 Answer 1

5

The values of the FieldType element of a CustomField are case sensitive. The legal values are documented in Metadata Field Types, under FieldType.

Your CSV file needs to specify the type Text, not text. You can demonstrate this for yourself by pulling the metadata down for an object containing a text field and changing its type to text - you'll get the same error if you try to deploy that metadata.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .