Describes a stall error that can occur on a database writer when writing lookup values – ‘Cannot set Column ‘XXXX’ to be null’. Please use DBNull instead.
Workflow stalling at the database writer stage with the following error:
Exception: Cannot set Column ‘XXXX’ to be null. Please use DBNull instead.
Steps to recreate the issue:
1. Create a workflow and place a lookup on the workflow from.
2. Place some Filtered Lookups(on a Repeating Section which is placed on a Tabbed Folder) filtering on the previous lookup field
3. On a Database Writer, map the Primary Key to the Repeating Section ID and map these filtered lookups to some Text fields on the table.
4. Submit this form without selecting any values on the Filtered Lookups.
The Database Writer will stall with the above message.
It is failing because of the way the mapping is defined in the database writer for this lookup field. It will have been mapped to the ‘Primary Key’ value of the lookup (eg. Input Form\REPORTSTO\Primary Key) and if there is no data it is unable to lookup the primary key for the item.
How to resolve the issue:
Either change the field types on the writer table to Lookup rather than Text or prevent workflow forms from being submitted that have blank filtered lookups via the ‘Cannot be blank’ property box.
OR Amend the Database Writer mapping to map to the field on the input form rather than using it’s primary key.
For example, replace:
Input Form\REPORTSTO\Primary Key