17
Feb
10

Checking for a NULL Date Field in SharePoint Designer Workflow

Since I originally published this, I’ve found that you can simply store the date in a dynamic string and then test the string to see if it is empty.  Use the “Build Dynamic String” action.

image

image

Testing the variable to see if it is empty.

image

Even easier!

 

Here’s the original post.

I was recently teaching an Advanced SharePoint class in Richardson, TX and a student was expressing his frustration over Microsoft’s apparent oversight within the SharePoint Designer workflow wizard. One of the “IF” conditions is a simple testing of the value of a field…”If this equals that.” He wanted to test a date field in SharePoint to see if it was empty or not. Problem is, when you select a field that is typed as DATE in SharePoint Designer, there is no test for the empty or null condition. You can see this in the first figure.

image

It occurred to me that we might be able to change the type of the field to a string and then be able to perform the comparison. I used the “Build Dynamic String” action.

image

I selected the End Date custom field on my Expense Statements list and stored it in a new variable that was typed as STRING.

image

The results of this were not exactly what I expected, however I was able to determine, through trial and error (sending the values in an email), that the conversion created a string that was filled with question marks (????). Therefore, if you simply test to see if the new string begins with a ?, you can successfully test for an empty date value.

image

Both my student and I were happy with the results.

Advertisements

6 Responses to “Checking for a NULL Date Field in SharePoint Designer Workflow”


  1. 1 Alan Steffens
    October 29, 2010 at 4:54 pm

    Sharepoint Designer 2007 does not list “Store” in Workflow Designer – Workflow Actions – Choose an Action drop-down box on my system. I am trying to add workflow to a customized Help Desk app template sites Service Requests list on a WSS 3.0 Intranet site I’ve developed here. Have you installed any add-on that provides you with that specific action as an option? Thanks – Alan

    • 2 Russell Wright
      October 31, 2010 at 7:19 pm

      Use the “Build a Dynamic String” action. That will get you the “store” function that you see in the pics. Russ.

  2. 3 Sharmin Khan
    May 31, 2011 at 1:19 pm

    Hello,
    i am trying to check two date fields in one single workflow and at least one of them would have a value in that field. So I was trying to store two of the dte fields in two different variables and compare them using is empty, but doing either one works but doing them both doesn’t work… any thoughts?

    Thank you in advance.

    Sharmin

  3. March 16, 2012 at 5:46 am

    How can you do this in sharepoint 2010? I can’t find this function.

    Thank you in advance.
    Henk

  4. 5 Baz
    August 28, 2012 at 3:17 am

    fantastic… thanks mate.. you are a gem!!

  5. 6 Norm
    January 30, 2014 at 11:38 pm

    Russ,
    Thank you very much. Exactly what I need for tomorrow’s project.


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


Asif Rehmani’s SharePoint Videos

SharePoint-Videos

Click to access a wealth of SharePoint videos

SharePoint Rx

SharePoint Rx Home

Categories

Posts by Date

February 2010
M T W T F S S
« Jan   Mar »
1234567
891011121314
15161718192021
22232425262728
Support Wikipedia

%d bloggers like this: