Search code examples
javascriptjsoninternet-explorer-7dynamics-crm-2011compatibility

odata query not working in ie 7


Hi i have an odata query which works perfectly fine in internet explorer 8 and above but not for internet explorer 7. I am hoping there is some kind of compatibility line i can insert somewhere before i go and create a different query method.

function setPriceListFromCurrency() {

var pricelevel = Xrm.Page.getAttribute("pricelevelid");
var currencyid = Xrm.Page.getAttribute("transactioncurrencyid").getValue();
if (currencyid == null) return;
SDK.REST.retrieveMultipleRecords("PriceLevel","?$select=PriceLevelId,Name&$filter=TransactionCurrencyId/Id eq guid'"+currencyid[0].id.substr(1, 36)+"'&$top=1",

    function (results)
    {
        //Results handler

        var pricelevelrecord = results[0];
        if (pricelevelrecord != null)
        {
            pricelevel.setValue(
            [{
            id: pricelevelrecord.PriceLevelId,
            name: pricelevelrecord.Name,
            entityType: 'pricelevel'
            }]
            );
        }
        else
        {
            alert("No Pricelist records are available with this currency.");
            pricelevel.setValue(null);
        }
    },

    function (error)
    {
        //Error handler
        alert(error.message);
        pricelevel.setValue(null);
    },
    function ()
    {
       //Complete handler
    }
  );

}


Solution

  • This question has been answered! the problem is due to the SDK.REST with the comment below. Internet Explorer does not support JSON.parse before version 8. You may use jQuery.parseJSON instead