I have two JS scripts on my SharePoint 2010 page, one in the master page, one in a forms web part (I've attempted this with a CEWP as well). Both are in unique name spaces (My.Tabs and My.Registration) They both work great, both read lists and display data.

If I check in a file on the page via a library web part, the page uses a dialog to check in, then closing the dialog the page reloads and neither web part works, both throwing the error:

SCRIPT5022: The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.

Which is erroring when I am in my Success method of my async call (noted with *)

var getTabConfig = function (callback) {
var currentPage = JSRequest.PathName;

var ctx = new SP.ClientContext.get_current();
var configList = ctx.get_site().get_rootWeb().get_lists().getByTitle("CONFIG");
var caml = '<View><Query><Where><Eq>' +
    '<FieldRef Name="Title"/><Value Type="Text">' + propertyPrefix + currentPage + '</Value>' +

var query = new SP.CamlQuery();

var configCol = configList.getItems(query);


ctx.executeQueryAsync(function () {
    ***if (configCol.get_count() > 0) {
    var itemEnum = configCol.getEnumerator();

This code works fine on every other page load, it looks like an issue with the dialog windows. Exploring the objects in my script (debugging) nothing is null, everything looks good, and the async call is even successful, so that's all working right?

The methods are being called via ExecuteOrDelayUntilScriptLoaded

If I navigate through the library, digging deeper into folders, the page posts back and everything continues to work. It's just when using the dialog windows...

1 Answer 1


There's not really enough here to know for sure. My guess is that configCol simply isn't defined at that point. The dialog context is probably different enough that something is missing. You might want to just put a check in the code to see if you're in a dialog and skip things if you are.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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