1

I using JSOM. My CAML query does not match any records so no records are returned via the list.getItems(caml). Consequently the code that sets localstorage session values below fails

while (enumerator.moveNext()) {
    var listItem = enumerator.get_current();
// Make user friendly names for fields   
    ItemID = listItem.get_item('Site_x0020_ID') ;
    CoreCategory = listItem.get_item('Content_x0020_Category_x0020__x0').toString() ;
    CoreTitle = listItem.get_item('Title').toString() ;
    sessionStorage.SPClaimsWebSiteCMSystemName = CoreCategory ;
    sessionStorage.SPClaimsWebSiteCMContentCategory = CoreTitle ;
    SPClaimsWebSiteCMSystemName = sessionStorage.SPClaimsWebSiteCMSystemName ;
    SPClaimsWebSiteCMContentCategory = sessionStorage.SPClaimsWebSiteCMContentCategory ;        

    alert ('SystemName: ' + SPClaimsWebSiteCMSystemName) ;
    alert ('CoreTitle: ' + SPClaimsWebSiteCMContentCategory )   

} // END WHILE 

That alerts fail because there is no matching record - appear when there is a matching record.

So the localstorage session values never get updated. (

What is the proper way to handle a query that fails to find any matching records

  • I want the localstorage values to be 'No Entry Found' for records that have no match

Thanks

Mohamed El-Qassas MVP
  • 45,382
  • 9
  • 53
  • 96
Etswatch
  • 31
  • 5

0 Answers0