Site workflow to query a list and filter fields based on certain dates

  • 25 January 2016
  • 7 replies
  • 21 views

Badge +2

Hi,

I am trying to build a site workflow which will query a list and filter fields based on certain dates.

I have added a Query list action to the workflow which queries my list and filters by fields which are empty which works fine but I also need it to filter by another date field where the date entered in "scheduling request" is 14 days ago.

I read a good few articles at this stage but just cant seem to figure it out ?

any guidance would be much appreciated

169771_pastedImage_0.png


7 replies

Badge +7

You will need to create a variable to store the date of "today minus 14 days". The variable is populated by the "Calculate date" action like this:

date_wf_01.png

And can then be used in the query:

date_wf_02.png

Badge +2

Thanks very much Eiben, I am on track now. However the query only appears to return one item in the list which matches the filter criteria but I know there are 2 items in the list. Am I missing something else ?

Badge +2

Sorry I figured it out, I was not storing the results in a variable collection.

So now I just need to figure out the For each Loop for the results.

Badge +7

To test the query you can use the "run now" button in the ribbon of the query action - this will execute the query and show you the results. This way you can check if the query returns the expected items.

Badge +2

Eiben, I am now trying to build a workflow that will send a notification 5 days before a "deadline date" which is a field in the list. I thought I could figure it out from the guidelines you send above with the calculate date field but no joy, could you please assist ?

Badge +7

Sorry for not replying sooner - I was quite busy the last couple of days.

OK -

1. so you have a list with a column called "deadline", which is a date-field - correct?

2. lets assume there is a date-column called "completion date"

2. you want to collect all items, which are due in 5 days and that don't have a completion date

In this case you calculate the the date of today plus 5 days.

due_5_001.png

Next you query the list for all items, which have no completion date and there deadline is within the next 5 days (so, the deadline is less or equal to today + 5 days).

due_5_002.png

Badge +2

Sorry Eiben, manic in work myself, thanks for help, I got it working:)

Reply