teowt

How to Query SharePoint List Item that were modified in Last X Days with Nintex Workflow?

Blog Post created by teowt Employee on Jan 14, 2015

Scenario: I want to query items that were modified in the last 7 calendar days.

 

How can I query the list to return record IDs: 208, 209, 210

Here with alternatives/tricky solution in creating your workflow.

First solution:

1. Go to workflow designer, drag Calculate date action:

Pic.jpg

2. Configure the Calculate date as below:

Pic2.jpg

 

3. Pass the Data and time variable in Query List action:

Pic3.jpg

 

Second solution:

1. Before creating your workflow, go to your list setting and

  • create a new column (Calculated type) named “Last 7 Days” and
  • formula as "=[Modified]+7"

Note: If you want Date range of 2 days, then you can + 2.

 

2. After that, the column will be auto shown in your list with formatted value.

Note: The Modified column is auto updated if any changes to the item, the new column that been created will be auto updated as well. Both are not editable.

 

3. Go to Nintex workflow designer, drag the action Query List and create a “Today date” variable by click on Variables option from Query List action’s ribbon.


4. Click on New button from ribbon.


5. Create “Today date” variable with configuration as below and click save button.

 

6. Then add a filter rule of “Last 7 days” is greater than or equal to [Today date] in query list action

 

7. Publish and run the workflow, the result of the Query List action will only return those records that were modified in last 7 days.

 

8. The result of query will return record ID: 208,209,210

Filter rules: Is greater than or equal to today date (1/15/2015)

 

Record ID

Modified

Modified date compare with today date
  (1/15/2015)

Last 7 days(Modified + 7 days)

Is “Last 7 days” greater than or equal
  to today date (1/15/2015)?

205

4/21/2014 3:55 PM

Modified more than 7 days from today.

4/28/2014 3:55 PM

No

206

4/21/2014 3:55 PM

Modified more than 7 days from today.

4/28/2014 3:55 PM

No

207

4/21/2014 3:55 PM

Modified more than 7 days from today.

4/28/2014 3:55 PM

No

208

1/14/2015
5:04 PM

Modified 1 day ago.

1/21/2015 5:04 PM

Yes

209

1/15/2015 10:04 AM

Modified today.

1/22/2015 10:04 AM

Yes

210

1/15/2015
10:04 AM

Modified today.

1/22/2015 10:04 AM

Yes

Outcomes