1

Working in SharePoint, trying to retrieve and process data from multiple lists. The return from the second list is getting paged, which breaks the ordering (as far as I can tell). So, my thought was to LITERALLY nest a new 'when' for this second list access that must loop to gather all the data returned. But I just get a generic 'syntax error'. I have no clue what else to try.

This is what I was trying (that is just a syntax error):

$.when(
    RetrieveProductData())
.then(
    $.when(
        RetrieveMilestoneData("https://<myEmployersProprietaryURL>"))
    .then(
        DisplayReportData)
    .then(function() {
        $("#ProcessingDiv").hide();
    });
);

Anybody have any suggestions? I'm completely stuck...

Thanks.

More info: both RetrieveProductData and RetrieveMilestoneData make $.getJSON calls to proprietary REST URLS. I'm passing the URL into RetrieveMilestoneData, so that I can grab the '__next' URL from returned results, and just recurse back into RetrieveMilestoneData with the '__next' URL as the parameter.

DisplayReportData NEEDS the information from both the RPD and RMD functions to work correctly...

mired
  • 51
  • 1
  • 1
  • 4

1 Answers1

0

you are having not only nested .then, but also two .then after eachother. I think this is not the correct way.

This should work:

$.when(
    RetrieveProductData())
.then(function() {
    $.when(
        RetrieveMilestoneData("https://<myEmployersProprietaryURL>"))
    .then(function() {
        DisplayReportData;
        $("#ProcessingDiv").hide();
    });
});
Christian
  • 4,596
  • 1
  • 26
  • 33