Retrieve all OptionSet values using OData in Dynam

2019-02-17 23:22发布

I am quite new to Dynamics CRM. I am building an app which should update entity in Dynamics CRM. I can update simple types without any issues. Now the situation is, I have declared some custom Option Sets in Contact entity.

Is there any way to retrieve all the possible OptionSet values (text and value) so that my app can look for appropriate value and set it in the payload it is generating?

I can not find any endpoint in WebAPI as well as XRMServices/2011/OrganizationData.svc. Any help would be really awesome.

1条回答
甜甜的少女心
2楼-- · 2019-02-17 23:53

You can use either the Web API or Organisation Service to retrieve The metadata and data models in Microsoft Dynamics CRM. Check out the sub articles of that one for specific examples and details.

Web API example Querying EntityMetadata attributes.

The following query will return only the PicklistAttributeMetadata attributes and will include the LogicalName as well as expanding the OptionSet and GlobalOptionSet collection-valued navigation properties.

GET [Organization URI]/api/data/v8.1/EntityDefinitions(70816501-edb9-4740-a16c-6a5efbc05d84)/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet
查看更多
登录 后发表回答