Hi
Following is the code which I wrote for accessing the selected option set's value for a particular record. But I am not getting the object's value.
Can anyone let me know how to get the text values(Labels) for the selected option sets, please.
<title>Test</title><script src="../ClientGlobalContext.js.aspx" type="text/javascript"><script src="Scripts/jquery1.4.1.min.js" type="text/javascript"></telerik:script><script src="Scripts/json2.js" type="text/javascript"></telerik:script>Hi Everyone,</p><p>I am using following SDK.REST call for getting the option set text value, which is selected for the Account record.</p><script type="text/javascript">if (typeof (NS) == "undefined") { NS = { _namespace: true }; } NS.CATEGORY = { getRESTUrl: function () { ///&lt;summary&gt; /// Returns a valid URL for REST endpoint requests. ///&lt;/summary&gt; var RESTServicePath = "/xrmservices/2011/organizationdata.svc"; var serverUrl = ""; if (typeof GetGlobalContext == "function") { var context = GetGlobalContext(); serverUrl = context.getServerUrl(); } else { if (typeof Xrm.Page.context == "object") { serverUrl = Xrm.Page.context.getServerUrl(); } else { throw new Error("Unable to access the server URL"); } } if (serverUrl.match(/\/$/)) { serverUrl = serverUrl.substring(0, serverUrl.length - 1); } return serverUrl + RESTServicePath; }, errorHandler: function () { alert("Error"); }, getOptions: function () { SDK.REST.retrieveMultipleRecords("Account","$select=Address1_AddressTypeCode,ShippingMethodCode", function (results) { flag = 0; fieldAttribute = results[0]; if (fieldAttribute != null) { alert(fieldAttribute.Address1_AddressTypeCode); } else { alert("error"); } }, NS.CATEGORY.errorHandler, function () { }); }, _namespace: true }; NS.CATEGORY.getOptions(); </script></script>
<html><head><title>Test</title><script type="text/javascript" src="../ClientGlobalContext.js.aspx"></script><script type="text/javascript" src="Scripts/SDK.RestEndpointPaging.js"></script><script type="text/javascript" src="scripts/SDK.REST.js"></script><script type="text/javascript" src="Scripts/jquery1.4.1.min.js"></script><script type="text/javascript" src="Scripts/json2.js"></script><script type="text/javascript"> if (typeof (NS) == "undefined") { NS = { _namespace: true }; } NS.CATEGORY = { getRESTUrl: function () { ///<summary> /// Returns a valid URL for REST endpoint requests. ///</summary> var RESTServicePath = "/xrmservices/2011/organizationdata.svc"; var serverUrl = ""; if (typeof GetGlobalContext == "function") { var context = GetGlobalContext(); serverUrl = context.getServerUrl(); } else { if (typeof Xrm.Page.context == "object") { serverUrl = Xrm.Page.context.getServerUrl(); } else { throw new Error("Unable to access the server URL"); } } if (serverUrl.match(/\/$/)) { serverUrl = serverUrl.substring(0, serverUrl.length - 1); } return serverUrl + RESTServicePath; }, errorHandler: function () { alert("Error"); }, getOptions: function () { SDK.REST.retrieveMultipleRecords("Account", "$select=Address1_AddressTypeCode,ShippingMethodCode", function (results) { flag = 0; fieldAttribute = results[0]; if (fieldAttribute != null) { alert(fieldAttribute.Address1_AddressTypeCode); } else { alert("error"); } }, NS.CATEGORY.errorHandler, function () { }); }, _namespace: true }; NS.CATEGORY.getOptions(); </script></head><body></body></html>
Thanks,
Rajeev