Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

request failed The given key was not present in the dictionary. undefined

$
0
0

Hi,

I'm receiving the below error whem i'm quering the external list using ECMA script.
---------------------------
request failed The given key was not present in the dictionary.
undefined
---------------------------

ECMA Script code

function getDataFromList() {

    var empNo = document.getElementById('EmpNoTextBox');
    this.context = new SP.ClientContext.get_current();
    this.oSite = context.get_site();
    this.oWebsite = this.oSite.get_rootWeb();

    this.employeeList = oWebsite.get_lists().getByTitle('EmployeeDetails');
    var camlQuery = new SP.CamlQuery();
    var q = '<View>' +
                '<Query><Where><Eq><FieldRef Name="EmpNo"/><Value Type="Text">01002</Value></Eq></Where></Query>' +
                 '<ViewFields><FieldRef Name="EmpNo"/><FieldRef Name="EmpName"/></ViewFields>' +
             '</View>';
    camlQuery.set_viewXml(q);

    this.listItems = this.employeeList.getItems(camlQuery);
    //context.load(listItems, 'Include(EmpNo,EmpName)');
    context.load(listItems);
    context.executeQueryAsync(Function.createDelegate(this, this.onListItemsLoadSuccess), Function.createDelegate(this, this.onQueryFailed));
}

function onListItemsLoadSuccess(sender, args) {    
    alert('Success');
}

function onQueryFailed(sender, args) {
    alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
}


Anandhan.S Remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.


Viewing all articles
Browse latest Browse all 11571

Trending Articles



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