I am using Metadata WSDL along with Partner WSDl to work on metadata API to create fields.
I am able to create fields of type text, checkbox, etc, but I need to create a picklist field and add picklist values to it.
Below is the source code i have written. I am not sure where to add the picklist values.
CustomField customField = new CustomField();
customField.setFullName("Account.customPickField__c");
customField.setLabel("customPickField");
customField.setType(FieldType.Picklist);
SaveResult[] results = metadataConnection.createMetadata(new Metadata[] {customField});
I have seen forums where people says to use
customField.setPicklist();
But this method is not available .
I am using a java application, to connection to a salesforce org with version 39.0.