SHARE
TWEET

Untitled

a guest Jul 19th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var LastID;
  2. function QueryLastNewStatusItem() {
  3.     var clientContext = new SP.ClientContext();
  4.     var List = clientContext.get_web().get_lists().getByTitle('Tracker');
  5.     var query = new SP.CamlQuery();
  6.     var textCaml ="
  7.         <View>
  8.         <RowLimit>1</RowLimit>
  9.         <Query>
  10.             <OrderBy>
  11.             <FieldRef Name='ID' Ascending='False' />
  12.             </OrderBy>
  13.             <Where>
  14.             <Eq>
  15.                 <FieldRef Name='Status' />
  16.                 <Value Type='Text'>New</Value>
  17.             </Eq>
  18.         </Where>
  19.         </Query>
  20.         </View>";
  21.     query.set_viewXml(textCaml);
  22.     var item = List.getItems(query);
  23.     context.load(item);
  24.     LastID = GetItemID(item);
  25.     alert(LastID);
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top