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.
-
Does it mean that you want to know according to which principle you can use Metadata Api to perform changes into environment by deployment rather then point to click? If so - this may help you developer.salesforce.com/docs/atlas.en-us.api_meta.meta/…– kurunveCommented Jun 20, 2018 at 13:11
1 Answer
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.