Paul Galvin's (old) SharePoint space [SharePoint

Just another WordPress.com site

Compare / Test for Blank Dates in SharePoint Designer Workflow

Scenario: In a SharePoint Designer workflow, you need to determine if a date field is blank.  

Problem: SPD does not provide a direct method for comparing dates to anything other than a date.  You cannot create a condition like this: "If [DateField] equals blank".

Solution: Convert the date to a string.  Use string comparison to determine if the date is blank. 

Screen Shots:

The following screen shots show how to do this.  In this scenario, a field on an item, "Environmental Permits:First Permit Reminder Date", is submitted and the workflow fires in response.

 

 

Notes:

When I tried this, I was pleasantly surprised to learn that it works.  I was worried that SharePoint Designer might disallow the string assignment (Variable:StringReminderDateDate) but it did allow it.

I was also concerned that allowing it, the value might be null and either blow up the WF at runtime or maybe raise the global temperature 1/2 a degree, but those concerns were unfounded.

</end>

Technorati Tags:
Advertisements

5 responses to “Compare / Test for Blank Dates in SharePoint Designer Workflow

  1. A January 3, 2008 at 10:32 pm

    Simple, yet clever.  Thanks!

  2. Unknown January 25, 2008 at 11:25 am

    Great! Exactly what I needed! Thanks.

  3. Unknown March 3, 2008 at 9:57 am

    Great tip. Works perfectly.
     
    Now I\’m looking for a way toset a non-required date to empty inside workflow. Any ideas?

  4. J October 24, 2008 at 9:56 am

    Why not just test the condition:
    If Field is greater than or equal to Today
    or Field is less than or equal to Today
     
    This would give you an "if field is not blank, do this, else (field is blank) do that"

  5. Tim March 23, 2009 at 12:57 am

    Questions:1) When I tried the above, it\’s not working because the value of a blank date seems to be "?????" (I believe this is a transposed NULL value). When I display the contents of the dynamic string, it shows up as "?????".2) Joe – when you wrote "If Field is greater than or equal to Today or Field is less than or equal to Today", do you mean that you can use variables like "Today" in workflows? If so, can you explain how? I\’ve had no luck trying, and I\’ve only been able to extract values that exist in lists.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: