Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

CRM 2013 Odata JavaScirpt how get optionset value.?

$
0
0

I am using CRM 2013...

I want to get optionset value retrun from Odata Rest Single Retrieve query

I am using this code i know to get textfiled value but how get Optionset value return by jquery Odata

 function Template_onchange() {
    var eventTemplateId = Xrm.Page.getAttribute("new_fromtemplate").getValue() != null ? Xrm.Page.getAttribute("new_fromtemplate").getValue()[0].id : null;
    if (eventTemplateId != null) {
        var account = GetEventTemplateData(eventTemplateId);
        if (account != null && account[0] != null) {
                  alert(account[0].new_MaxNumberofParticipants);
        }
    }
}


function GetEventTemplateData(eventTemplateId) {
    var serverUrl = Xrm.Page.context.getServerUrl();
    var oDataUri = serverUrl + "/xrmservices/2011/OrganizationData.svc/new_eventtempalteSet(guid'" + eventTemplateId + "')?$select=*";
    var jSonArray = new Array();

    jQuery.ajax({
        type: "GET",
        contentType: "application/json; charset=utf-8",
        datatype: "json",
        url: oDataUri,
        async: false,
        beforeSend: function (XMLHttpRequest) {
            //Specifying this header ensures that the results will be returned as JSON.            
            XMLHttpRequest.setRequestHeader("Accept", "application/json");
        },
        success: function (data, textStatus, XmlHttpRequest) {
            if (data && data.d != null) {
                jSonArray.push(data.d);
            }
        },
        error: function (XmlHttpRequest, textStatus, errorThrown) {
            alert("Error :  has occured during retrieval of the Account details");
        }
    });

    return jSonArray;
}


Muhammad Sohail



Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>