I am trying to create a document on a list if a
date list field is set.

So I have a workflow that executes when a list item is changed. In the workflow, I have set a workflow variable X to mydate (mydate is returned as string). Then I have tried the condition : create the element if X is empty. But it doesn't work as the element is created in any case (either the date is set or not).

So, I turned to regular expressions.

The check I am using trying:

if X corresponds to regular expression  [0-9]{2}\/[0-9]{2}\/[0-9]{4}
   create item in MyLibrary

Anyway, this doesn't work as the item in MyLibrary is created either if mydate is empty or set to a proper date. ? I have tried others regex that match a date but with no luck.

I am using Sharepoint 2013 with a workflow 2010. If the regular expression doesn't match a date no item gets created.

Is there anything wrong with my regular expression?

EDIT: in the end I used X contains 2. For 985 years it should be ok...

1 Answer 1


Empty dates are not as they seem.

Make an action to log the empty date value (assign it to a workflow variable) to the workflow history list for debug purposes, and you'll see a value similar to 1/01/0001.

Once you know that you can check for the substring, and if it matches do whatever else you need to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.