SharePoint Workflow error:
Coercion Failed: Unable to transform the input lookup data into the requested type.
Using a workflow, I was trying to set the value of a Lookup field. Where I went wrong was, setting the Lookup field to a field other than the ID column of the Lookup List.
Created two lists.
Taco and Taco Topping.
Taco Toppings fields: Title, Meat, Cheese, Salsa
In the Taco list, I added a Lookup field to Taco Topping, also adding Meat, Cheese, and Salsa fields.
Now for the workflow.
On the Taco list, create a new SharePoint Designer workflow.
The workflow will contain the following actions: Set Workflow Variable and Update List Item
First we will create the variable
click inside of Step 1, from the ribbon click on Action, then find Set Workflow Variable.
Once it’s added to the workflow step, click on blue workflow variable text.
I named my variable Taco ID and set the type to Number.
Next click on the blue value text.
Here I’m querying the Taco Topping list for the ID field, and filtering by the Title column of the Title fields of Taco and Taco Topping. Think of this a simple SQL select statement with a where clause. Select ID from Taco Topping where Title = Current Item: Title
Next we will add the Update List Item action.
Click below the Set Variable action, then add the Update List Item from the Action button in the ribbon.
Click on the blue this list text.
Here I’m updating field T to the ID from workflow variable Topping ID.
This is what will drive updating our Taco list to the toppings from Taco Topping.
Publish the workflow, all done!
*Be sure to change your workflow settings (in the ribbon) if you want the workflow to run when a new item is added or changed.*