Monthly Archives: September 2015

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. 🙂

Multi-line text fields, character count limits, and scrolling… that was unexpected.

So I got this request to make a multi-line text field scroll in one of my forms. That sounded easy enough. But there seems to be a problem when you also have a line-character length set. If you set a line character limit, it greys out the ability to set it as a multi-line field.

To get around that, I decided to hack the field validation a bit. Instead of using the character limit count in the list item, I used an expression in the validation rule to check the character length and fire an error if it’s over 320 characters:

20150901Image01

That was the magic combination to allow the text to scroll down in the field, while still limiting the number of characters allowed. Instead of just stopping at the 321st character, it fires a validation error if it goes over that length.

Not quite as clean as the character size limit field on the list item, but it works.