Dynamics 365-从全局选项集中获取所选选项的值 [英] Dynamics 365 - Get the value for selected option from Global Option Set

查看:179
本文介绍了Dynamics 365-从全局选项集中获取所选选项的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一种方法来获取基于GlobalOptionSet的字段的值.我正在设法从端点拉回数据

参考

I'm trying to find a way to get a value for my field which is based on a GlobalOptionSet. I'm managing to pull back data from my endpoint https://TEST.test.dynamics.com/api/data/v9.1/projects which is returning my list of projects. some of the fields on this dataset just show as GUID's which I've managed to expand into and get their values. However, some of the fields returned are showing just numbers like 866110000 which I believe is an option in a GlobalOptionSet.

I know I can get the GlobalOptionSet definition and match up its value but I'm hoping to be able to get this information in a single query similar to the way I got other fields by expanding.

Does anyone know how to get it to return the selected Value for an option field instead of the ID of the option that was picked?

Thanks

解决方案

All you have to do is include the below header to get the needed optionset & lookup display name values. Read more

Prefer: odata.include-annotations="OData.Community.Display.V1.FormattedValue"

Sample request:

GET [Organization URI]/api/data/v9.1/accounts?$select=name,donotpostalmail,accountratingcode,numberofemployees,revenue
&$top=1 HTTP/1.1  
Accept: application/json  
OData-MaxVersion: 4.0  
OData-Version: 4.0  
Prefer: odata.include-annotations="OData.Community.Display.V1.FormattedValue"

If its AJAX request using jQuery or XmlHttpRequest, for ex.

req.setRequestHeader("Prefer", "odata.include-annotations=OData.Community.Display.V1.FormattedValue"); 

Reference

这篇关于Dynamics 365-从全局选项集中获取所选选项的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆