SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I have 10 sharepoint lists.structure,column name,data type all are same. I need to check whether a particular item is found in any list then do some action using ecmascript.

     var arraylist=["A","B",.......];
     for(var i=0;i<arraylist.length;i++)
        //using caml query here and loading collection

      clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

      function onQuerySucceded()
       var count=this.colllistitem.get_count();
       //**How can I put a break here?.Item exists..I dont want any more iteration..**

Pls help me how can I apply a break there ..I dont want any further iteration of arraylist.

share|improve this question
If you declare a global variable which you set when count!=0 and then test it on your iteration to stop it, does it work? – JoseTeixeira Jun 14 '13 at 16:43
ok.I will give it a try. – Neel Jun 14 '13 at 16:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.