Want to compare a field against a blank date? Put a blank date in your list…

This is sort of a “why would you do that?” thing, but it’s saved me a lot of time when it comes to SharePoint Designer workflows.

I’ve always had problems trying to compare a variable in the workflow against a blank date, because every date variable wants you to populate it with the current date or some other set date. Furthermore, there’s no “Is Empty” as a comparison option.

I know you can compare the string to some magical date of 1/1/0001, but I’m always afraid I’m going to make a typo or that default date is going to change some time in the future. Instead, I prefer to let SharePoint do the work for me.

I create a list column with the name of EmptyDate and I don’t give it a default value. Therefore, when it comes time to compare dates, I already have a blank date field in the list that I can use for the comparison. Since I normally customize my list forms using InfoPath, I just choose not to put that field on the form.

I don’t have to remember any magical dates, nor do I have to worry about anyone coming behind me and messing up that value by adding leading zeros or something. It just works. 🙂

One response to “Want to compare a field against a blank date? Put a blank date in your list…

  1. Pingback: Comparing People Picker names to blank values? I use a BlankName field… | SharePoint Duffbert

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 )

Facebook photo

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

Connecting to %s