locked
OData eval lookup field RRS feed

  • Question

  • Hi,

    What I am doing wrong, I can not eval lookup field ?

     

    $.ajax({       
    
    type: "GET",       
    contentType: "application/json; charset=utf-8",       
    datatype: "json",       
    url: OdataSelect,       
    beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); },       
    success: function (data, textStatus, XmlHttpRequest)            
    {                
    
    var CustomerServiceData = data.d;
    alert(CustomerServiceData)
    var LookupValue = eval('CustomerServiceData.new_Service.Value');
    alert(LookupValue)
    
    },       
    
    error: function (XmlHttpRequest, textStatus, errorThrown) { alert('OData Select Failed: ' + odataSelect); }   
    
    });
    
    }
    
    }
    
    Tuesday, October 11, 2011 2:00 PM

Answers

  • var LookupValue = CustomerServiceData.new_Service.Id;
    • Marked as answer by Nicetobe Tuesday, December 13, 2011 2:57 PM
    Tuesday, November 1, 2011 8:38 PM

All replies

  • LookupValue in your code is a object and I don't think it will display anything.

    Try LookupValue.Name or LookupValue.Id

    What is this eval function? Could you please post the whole code?

    I hope this helps.


    Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia http://mscrmshop.blogspot.com
    Wednesday, October 12, 2011 5:59 AM
  • var LookupValue = CustomerServiceData.new_Service.Id;
    • Marked as answer by Nicetobe Tuesday, December 13, 2011 2:57 PM
    Tuesday, November 1, 2011 8:38 PM