0

I use Sharepoint Online and Sharepoint Designer 2013 workflows. I have a loop workflow that uses variables in date format. When the loop starts again it uses the variable from the first loop.

Normally, when a date field is blank, variable is set as 01/01/0001 and then the value is taken from a date field using REST API and GET call. Then, when the loop runs again and tries to get a date value from second item in the list with blank date, the date remains from the first item in the list.

How can I reset date variables?

enter image description here

The first time the command: then get Asbestos from Variable: item (Output to Variable: asbestosDate) is run, trying to read an empty date field, it returns 01/01/0001 which is what I want.

If the command: then get Asbestos from Variable: item (Output to Variable: asbestosDate) is run, trying to read a date from a field WITH date, it returns correct date:

Then, if the same call is run after the previous call WITH date, the same dates remains stored in this variable.

Why?

0

try to "initialize" the date-variable before the REST-call. When the date is not set, your variable will not be modified - so you'll need to ensure it is always modified using "something".

If you're using a SharePoint 2010 Workflow using SharePoint designer you could use the Add time to date-Action like this: enter image description here

  • please could you be more specific? – Maciek Jul 20 '17 at 20:15
  • @Maciek: Probably, but what is the question about? SharePoint-Workflows? Created using SharePoint-Designer? – Nils Jul 20 '17 at 20:18
  • i added a screenshot and a note below it. – Maciek Jul 20 '17 at 20:38
  • I updated the answer to include an image from a 2010-Workflow. I have no 2013-Workflow Services at hands right now. – Nils Jul 20 '17 at 20:38
  • @Maciek: set AsbestosDate to BlankDate right after setting BlankDate will not work for you? – Nils Jul 20 '17 at 20:41
0

I fixed my problem by adding ELSE BRANCH to the bottom on every IF statement.

Now it's:

if..1
if...2
else....3

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.