0

Lately I get this error (see pic), however if I click continue everything works perfectly and the value is assigned correctly to variable xAppWebUrl. In another script I have similar code that runs without throwing an error. Any ideas what might be wrong here? Thanks!!

Error text in English: "The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested."

enter image description here

0

This error typically arises when we try to access a field that was not requested.

Try below

ctx.load(this.oListItem, 'Include(xValue)');
  • the Async query fails when I add the 'Include(xValue)' to ctx.load, Any idea ? Really strange that it throws an error but does assign the value... – tomvanderhoek Apr 11 '15 at 0:50
  • and even weirder that the error is not thrown always, but just sometimes. Maybe has something to do with my monkeyball internet connection. – tomvanderhoek Apr 11 '15 at 0:55
  • Make sure you are executing after SharePoint js files are loaded. Look ExecuteOrDelayUntilScriptLoaded – Amal Hashim Apr 11 '15 at 0:57
0

Finally I found it, apparently this does work but thows an error:

this.oListItem = oList.getItemById(1);
ctx.load(this.oListItem);
ctx.executeQueryAsync(
    Function.createDelegate(
        this,
        function () {
            console.log("scriptAddMenuToListView.js: AppWebUrl successfully retrieved from lstAppData...");
            var xAppWebUrl = this.oListItem.get_item('xValue');
            fxCreateMenuHTML(xAppWebUrl);
        }),
    function () { console.log("scriptAddMenuToListView.js: Query to obtain AppWebUrl from lstAppData failed...") }
    );

and this works as well but DOES NOT throw an error:

var oListItem = oList.getItemById(1);
ctx.load(oListItem);
ctx.executeQueryAsync(
    function () {
        var xAppWebUrl = oListItem.get_item('xValue');
        console.log("scriptAddMenuToListView.js: AppWebUrl successfully retrieved from lstAppData, xAppWebUrl==" + xAppWebUrl);
        fxCreateMenuHTML(xAppWebUrl);
    },
    function () {
        console.log("scriptAddMenuToListView: Query to obtain AppWebUrl from lstAppData failed, msg==" + args.get_message());
    })

still don't knw why the first peace of code throws an error though, but happy that things are working now :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.