I'm currently working on adding custom fields to an object. However I can't find any documentation or something like this which would indicate me to what should I do to create for example picklist or any other field or something totally different, generally how to create anything in xml like a programmer, not by clicking.


1 Answer 1


The thing that you're looking for is the Metadata API. More specifically, I think you're looking for the documentation on Metadata Types

The documentation there will tell you the tags you can use to define a custom field, and there's usually some example XML at the bottom of each page.

What's not as clear is which metadata types you need to use. Creating a new field is (relatively) easy, it's the CustomField metadata type. Defining picklist values depends on what API version you're targeting. Prior to API v37.0, they were defined as Picklist and PicklistValue. API v37.0 and later (aka Summer '16. The current API version at time of writing is 43.0) uses ValueSet and ValueSetValue (documentation on this page), unless you're trying to modify a standard picklist field (StandardValueSet) or a global picklist (GlobalPicklist and GlobalPicklistValue for custom global picklists, and GlobalValueSet for a standard global picklist...I think, not 100% sure on that).

It gets fairly gnarly fairly quickly. In most situations, it's easier (and faster) to just use clicks to define/manage metadata.

You must log in to answer this question.

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