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

Problem with optionset when retrieving from another entity

$
0
0

hi frnds,

i have some issue when retrieving optiontset value from antoher entity...

function retrieveOptionset(){

LookupFieldObject = Xrm.Page.data.entity.attributes.get('customerid');
var Organizationid;
if (LookupFieldObject.getValue() != null)
{
Organizationid = LookupFieldObject.getValue()[0].id;
var resultentities=GetEntities(Organizationid)
if (resultentities!= null && resultentities[0].results.length > 0) {
for (var count = 0; count < resultentities[0].results.length; count++) {
var Entitylevel=resultentities[0].results[count].new_EntityLevel_P;

//new_EntityLevel_P is optionset

alert(Entitylevel)//here am getting object;

var Text=Entitylevel.text;

alert(Text) //Here is my problem.. it showing undefined..i need here the text and value

}
}
}
}

//This is my odata query using javascript

function GetEntities(orgid) {
    var serverUrl = Xrm.Page.context.getServerUrl();
    var oDataUri = serverUrl + "/xrmservices/2011/OrganizationData.svc/new_organizationentitySet?$select=new_EntityLevel_P&$filter=new_Organization/Id eq guid'" +orgid+ "'";
    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 contacts");
        }
    });

    return jSonArray;
}

can any one give me a solution as soon as possible...Thanx in advance...


Arun Kumar G




Viewing all articles
Browse latest Browse all 8223

Trending Articles



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