Archive for February 17th, 2010

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.




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