locked
Internal Server Error in crm 2013 RRS feed

  • Question

  • Hi,

    when i get lookup attribute value Internal server error occurred. Please tell me how to resolve my issue

    here is my script 

    function GetEmail() {
    var EntitySchemaname="new_datacentreSet";// may be new_buyerSet ?
    var Relationshipname="new_new_datacentre_new_dealer_DataCentre";

    var Buyerlookup=Array();
    Buyerlookup=Xrm.Page.getAttribute("new_DataCentre").getValue();
    alert(Buyerlookup[0].id);
    if (Buyerlookup == null || Buyerlookup == undefined)
    {
    alert("sorry");
    }
    else
    {
    serverUrl = Xrm.Page.context.getClientUrl();
    var req = new XMLHttpRequest();
    req.open('GET', encodeURI(serverUrl + "/XRMServices/2011/OrganizationData.svc/"+EntitySchemaname+"(guid'" + Buyerlookup[0].id + "')?$select=new_Website,Relationshipname"), true);
     req.setRequestHeader('Accept', 'application/json');
     req.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
     req.onreadystatechange = function () {
     if (this.readyState == 4) {
     req.onreadystatechange = null;
     if (this.status == 200)
     { var result = JSON.parse(req.responseText).d;
     var EMailAddress1 = result.new_Website; // change this field with new_email schema name
     alert(EMailAddress1); }
     else { alert(this.statusText); } } };
     req.send();
    }
    }

    Friday, March 21, 2014 5:29 PM