Skip to content

Errors with Null Date Time Fields in SharePoint 2010 Workflows

by on January 28, 2013

Error:

The workflow could not update the item, possibly because one or more columns for the item require a different type of information.

Cause:

In my case, the cause was a null or empty datetime I was using in a Created and Change start option workflow. The issue is that SharePoint may start the workflow prior to the item being fully created, and null datetimes are actully set as 1/1/0001. Strangely, you cannot test for this specific date or a null/empty datetime field.

SharePoint Null DateTime fields are “1/1/0001 12:00:00 AM”

If you are getting an inconsistent error when creating a document or item via a workflow, it may be due to the workflow kicking off prior to the item being fully completed or created. an easy way to fix this slippery error (since there is no “Is Empty” or Null value you can use in SharePoint Designer workflows, is to check an out of bounds date:

image

The Logic

Option 1

pause for duration set to 1 minute, do something

NOTE: This allows the workflow created item or document to finish setting properties, the setting of which at this stage does not seem to set off wait or other “change” events.)

NOTE: SharePoint actually checks these pauses every 5 minutes, so your actual wait time can be 1-6 minutes.

Option 2

If the created date is less than Jan 1900, wait for it to be greater than Jan 1900, Then do everything else.

NOTE: if there is another field you are using than datetime or created, make sure that has a value or is required in the list/library. You can create similar waits for these fields, though I recommend using waits sparingly, as they seem to be buggy in my experience.

Related Issue: Workflow Starting Before Properties of Document are Updated by User

a similar issue has to do with workflows starting prior to document properties being set. The solution is similar.

Option 1

Make an item, or the item used in a workflow required (this causes the workflow to kick off only when the property is filled in by the user on the edit view!)

Option 2

If modified is equal to created, wait till modified is greater than created, then do something.

Advertisements
2 Comments
  1. Andrew permalink

    I’m facing a similar issue, for an optional field, named “Date Available”

    When the field is left blank, the workflow fails (“Error occurred” status). But when I input a date, it completes successfully. However, I don’t want this field to be marked as “required” – users should be able to leave it blank.

    Do you have any suggestions?

  2. creating a view with a filter, such as for scheduling date, you can just say “is equal to” and leave it empty

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

%d bloggers like this: