markuden
Nintex Newbie

Multi-Lookup to Variable Error: Coercion Failed: Unable to transform the input lookup data into the requested type

Jump to solution

Hi!

 

I'm using SharePoint 2010 and Nintex Workflow 2010. I have a People list with a lookup to a second list of Groups. Each person can belong to one or more groups, so it's a multi-selection lookup.

 

I want to get the values of the lookup field into a workflow variable. This works if there are more than one group selected, but if only one group is selected it fails with the error "Coercion Failed: Unable to transform the input lookup data into the requested type."

 

I've tried various methods of getting this data into a variable, but I always get the same error where only one group is selected.

  1. "Set a variable" action with "Single line of text" variable.
  2. "Set a variable" action with "Multiple lines of text" variable.
  3. "Build string" action.
  4. "Query list" action filtered for ID of current item. This works when I use "Run Now", but not when the workflow operates.

 

Strangely, the workflow looks like it's completed according to the Nintex Workflow Progress page (i.e. all the action boxes are green), but the workflow status is "Error". Also, if I "Log in history list" the variable contents, they appear correct.

 

The following thread concerns a similar error, but is for setting a lookup field rather than just extracting its contents. The specified item was not found.

 

I'm making no progress on this. Any ideas, anyone?

 

Thanks,

 

Mark

Reply
1 Reply
markuden
Nintex Newbie

Re: Multi-Lookup to Variable Error: Coercion Failed: Unable to transform the input lookup data into the requested type

Jump to solution

I've managed to fix this problem myself. For the benefit of others who get a similar problem...

 

The Problem

Firstly, I was wrong about the exact situation in which this error occurs. It wasn't caused by lookups with only one item selected, it was lookups with no items selected that produced the error.

 

The Solution

Use a "Set a condition" or "Run if" action to determine if the lookup field is empty. If not, the lookup value(s) of the field can be assigned to a variable or another field. If it is empty, the variable or other field can be set to blank instead.

 

In my case, I wanted to update two text fields with the values of two lookups, so the workflow ended up looking like this, with a "Set a condition" action to check if each lookup was empty and "Update item" actions for each possibility.

Screenshot 261.jpg

View solution in original post

Reply