0

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.

The 'Variable: date1' is an output of 'Variable: date' plus -1440 minutes (24hrs prior).

The 'Variable: date' is set to 6:15 'Today'.

In order to have it re-run at the same time once a day I set it to Pause until 'Variable: date2'.

The '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.

Thanks.

  • Are you running the workflow on item created or item changed, or both? – Erin L Jul 29 '16 at 20:24
  • The work flow is a loop. Right now it is only triggered manually, then loops after that. – Nathan W Jul 29 '16 at 20:27
  • Could this be related to cached data in one of the variables? It is only pausing for a finite amount of time, then re-running from the beginning. It never ends the workflow. – Nathan W Aug 1 '16 at 8:18
  • As long as you're resetting the values of each variable on every iteration of the loop, I wouldn't expect any cached variable values. – Erin L Aug 1 '16 at 15:32
  • Is there an option for that? What would be an example of resetting the value? – Nathan W Aug 1 '16 at 22:58
0

The email body content 'Variable: content' which was a string, and being used in the loop in stage three, I ended up setting it as variable 'Variable: contentNULL' back up at stage 1.

So that after the pause 'Variable: content' would be reset and then made new when it stared from the beginning again. I achieved the NULL variable by trimming a single character value and outputting it to a result.

That result was set as contentNULL. The loop was reusing the email body variable 'content' yet I am still uncertain exactly how, but am assuming it was because it was set as string not another variable.

This what I explained got rid of the extra data accumulating being re-emailed ever day.

0

Variable values that should be different each time the loop is run have to be reset each time the loop runs. Set the values inside the loop instead of before the loop.

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.