I hope I explain this well enough and have provided enough information. Spent over a week on this and not really found any answers on the web...
I have a list setup for my team on Sharepoint 2013. Using workflow and REST we wanted to automate a report of items created since the last 24hrs.
So I have a workflow setup and it works iterating through the list looking for a date range of items created from a certain time frame to date now.
The first email it sends when the workflow is manually started has the accurate and completed list of information the way we need.
For some reason after it has paused for a full 24 hrs then it re-runs it will send the new data plus the data it had grabbed the day before on the last email even though that data is not queried or in the list of results/dictionary.
What could be causing this?
Here is what the the query URL variable is set to:
http://sharepoint/sites/OUR_TEAM_SITE/_api/web/lists('GUID')/Items?$select=Title,Status,AuthorId,Created,Modified,ID&$filter=Created ge datetime'[%Variable: ISOdate%]'&$orderby=Created asc
To achieve what we needed I set '
Variable: ISOdate' to '
date1' as ISO formatted.
Variable: date1' is an output of '
Variable: date' plus -1440 minutes (24hrs prior).
Variable: date' is set to 6:15 '
In order to have it re-run at the same time once a day I set it to Pause until '
Variable: date2' is an output of '
Variable: date' plus 1440 minutes (24 hrs later).
So it goes and gets all items created since the day before at 6:15am local time. It then pauses until the next day at 6:15am when it a runs again using a new ISOdate to query as it should.
I thought the dates were not calculating right at one point, but that was not the case. I listed them out as strings in the email to test.
I tested seeing if the dictionary data was storing info. or appending and adding it all to the email by also inserting those as strings into the email.
I saw what JSON items it is supposed to send the second time and even if it queried no items it sends the item(s) from before. If there was one new item created in the date range coming up it will send the information from the last email plus that data.
Maybe I have over complicated this but Sharepoint is not the most verbose tool to easily achieve what we want. What we have created will work if it only sends the information it is actually querying each time.