0

I want to fetch the records from List which are created in Last 5 minutes.

I have written following code, but its not working. giving me error.

  <Geq><FieldRef Name='CreatedDate' />
    <Value IncludeTimeValue='TRUE' Type='DateTime'>[Today-5Minute(s)]</Value>
 </Geq>

This Query is written in my JavaScript function.

1

Fieldref name should be 'Created', your query should look like :

<Where>
  <Geq>
    <FieldRef Name="Created" />
    <Value Type="DateTime">[Today-5Minute(s)]</Value>
  </Geq>
</Where>
  • No. Its not working for me. [Today-5Minute(s)] gives me error for Expected ']' when I write like this, var dateCriteria = "<And><Leq>" + "<FieldRef Name='Created' />" + "<Value Type='DateTime'>" + [Today-5Minute(s)] + "</Value>" + "</Leq></And>"; – Shahid Nov 28 '12 at 9:22
  • Here are some observations - Why are you not enclosing [Today-5Minute(s)] with ""? if you dont enclose it i.e. dont make it string then javascript will regard this as javascript variable which is not the case, apart from that you should use Geq for last 5 minues not Leq and if you use <And> then there should be 2 conditions, but I can find only one, you should use the entire text like - var dateCriteria ="<Where><Geq><FieldRef Name='Created' /><Value Type='DateTime'>[Today-5Minute(s)]</Value></Geq></Where>"; – Diptarag Nov 28 '12 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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