Monday, June 16, 2014

Review: SharePoint 2010 - Check DateTime Field is Blank (solution)

My preference in setting up flags is to use a datetime field. If there is a date, then the flag is set. If it is null, the the flag is not set. My problem is using SharePoint Designer to check if the datetime field is empty.

Solution

After some searching, I found the second solution in Reference-1 to work for me. The solution is to create a text field variable, then set the datetime field to the variable. The text variable will have the options to check if it is null, and will be null if the datetime field is null. For me the important step was making sure that the variable is of a type that triggers the conditional statement to include null checks.

Analysis

For whatever reason, the conditional statement does not include null for datetime fields. My guess is that there is something about checking datetime field as null because I did try the first checked solution in Reference-1 by setting a variable as null then comparing it to my datetime field.

As I write this, I think I may have created the variable as a datetime variable. There is a possibility that this may work if compared to a text variable set to null. I would check if I was not already frustrated with working with SharePoint and if I still had that example. Perhaps, I'll try this at a later time.

There was another alternate solution which I did not get around to doing. It requires another column. .

Reference

1- http://social.msdn.microsoft.com/Forums/en-US/6dc36021-5c7d-4d70-8ead-afa36c45dfd5/how-to-check-for-the-date-is-null-in-sharepoint-designer-condition-?forum=sharepointcustomizationlegacy
2 - http://howardmcd.wordpress.com/2013/05/20/how-to-check-if-a-date-field-is-blank-in-a-sharepoint-designer-workflow/