I have a workflow with a "Create Item" action in which I attempt to set a single line of text field ("TL1 Lookup Value" in the destination list) to the value of a list lookup type field in the current Item ("TL1 Lookup") where the return type is "Lookup Value (as Text)".
If the value of the "TL1 Lookup" field in the current item has not been set and is empty, then this action will throw a coercion error:
Create three custom lists, TL1, TL2 and TL3.
- Add an item with the title "Lookup Item 1"
- In List Settings, created a column "TL1 Lookup" and set it to get information from TL1 in the "Title" field:
- Add an item, setting the title to "Test Item 1" but don't chose a value for "TL1 Lookup" (leave it blank).
- Create the Nintex Workflow with a single "Create Item" action to create an item in TL3. Set the Title to the Title of the current item, and the "TL1 Lookup Value" to the current item "TL1 Lookup" with return type "Lookup Value (as Text)". I named it "TL2 Workflow".
Then I ran the workflow on the single list item in TL2.
Workflow displays the coercion error, fails to complete (shows no status at all) and does not create an item in TL3.
When I create a second item and set the lookup value, the workflow completes and creates an item in TL3
So with all that being said, this shouldn't result in a coercion failure right? Shouldn't the value return as an empty string?
The workaround has been to create a variable to contain the lookup value, then introduce some logic to determine if the lookup value is empty, and if not, then go ahead and fetch the lookup value as a string, put it into the variable, then in the "Create Item" action set the field to the variable value, and not the lookup value directly.