Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Question

How can I check for an empty date condition in a SharePoint Designer Workflow?

Background

I have a list called "Project" with multiple date fields. I have a calendar called "Project Scheduling" where I want to copy those dates. For every pair of two dates (such as "Construction Start"/"Construction End" and "Design Start"/"Design End") for a single "Project" listitem I want to create one list item in the calendar.

I do this by creating a workflow that triggers on add/change and will push the dates to the calendar if both dates in the pair have a value. To check for null dates I have to first store the string values of the dates in workflow variables because you cannot use the "is empty" condition with a date field. However, when I try to check for "is empty" on the date string values the string returns as not empty and it tries to execute my code for creating the item in the "Project Scheduling" calendar. For some reason that fails even though the string is not empty. I would assume that it would succeed seeing as how there was a value in the date string.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I tried logging the date string values before executing the creation of the listitem in the "Project Scheduling" calendar but the workflow would error without logging. Then I removed the listitem creation part and the logging worked. It was there that I noticed that the date values were set to 1/1/0001 12:00:00 AM.

Workflow History Date Values

I found the same problem on Cliff Chaney's Blog and he provided the solution of:

  1. Converting the date to a short date
  2. Storing the date in a string workflow variable
  3. Comparing the string workflow variable to "1/1/0001"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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