Search code examples
odatadynamics-crmmetadatamicrosoft-dynamicsdynamics-crm-webapi

Find picklist values in Dynamics via the Web API


I'm trying to determine how I can find the integer values for picklist fields in Dynamics via the web api. I can access the basic metadata by using:

GET https://[COMPANY].api.crm3.dynamics.com/api/data/v9.0//EntityDefinitions(LogicalName='lead')/Attributes/

but for picklist values I don't see the mapping of the integer value to the displayed string.

Is there a table that holds all of this or a way to expand this information on the above call?


Solution

  • You can use this to retrieve.

    https://[COMPANY].api.crm3.dynamics.com/api/data/v9.0/EntityDefinitions(LogicalName='{Entity Name}')/Attributes(LogicalName='{OptionSet Name}')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=GlobalOptionSet($select=Options)
    

    Reference