I mean these values, with their label and underlying value:
You can do so, using the Web API .However, status reason requires a different message to your usual option set.
- For option sets, use Microsoft.Dynamics.CRM.PicklistAttributeMetadata
- For status reasons, use Microsoft.Dynamics.CRM.StatusAttributeMetadata
Here are some examples
1. This example gets the labels and values of options on an option set called mediasource on the lead entity:
Of course for your scenario, you'll need to alter the HTTP request. Replace lead with the name of your entity and mediasource with the name of the option set you're trying to retrieve.
Remember you can test your HTTP request by sending it in your browser as https://yourcrmorganisation.crm11.dynamics.com/api/data/...
This request returns the following response:
2. Now if you want to get the value for statuscode which is also an option set, you have to use StatusAttributeMetadata rather than PicklistAttributeMetadata.
This example gets the labels and values of options on the status reason field on the lead entity:
Which returns the following response:
Again, in your specific HTTP request, replace lead with the name of your entity.
No comments:
Post a Comment