SharePoint workflow Canceled - Coercion Failed: Unable to transform the input lookup data into the requested type


SharePoint Designer Workflow problem with Lookup column There is a particular scenario in which you might receive the below error if using SharePoint Designer List Workflow.

Coercion Failed: Unable to transform the input lookup data into the requested type.
Workflow Scenario
Consider a SharePoint list called "Employee" with following schema.

Employee Name (Text)
Country (Lookup)

We create a SharePoint Designer workflow to send a simple email with Employee Name and Country when an item is created.

After publishing the workflow, let us see try creating a few items and see the outcome.

Workflow Problem

Though the workflow is pretty simple. We note that it worked fine where lookup values are the United Kingdom, United States, Spain, Australia, but fails when the lookup value is blank. It gets 'Canceled' in this case. If we look closely at the workflow history, it shows these details -

Event Typ - Error
User ID - System Account
Description - Coercion Failed: Unable to transform the input lookup data into the requested type

The description is useful for us - Coercion Failed: Unable to transform the input lookup data into the requested type.

Analysis and Troubleshooting

This happens when you use a Lookup site column in workflow and the value is BLANK/NULL. The workflow fails when transforming the Lookup data (blank in this case) into Lookup Value (as Text). Further steps of the workflow will not be reached and it gets canceled and logs the error.

How to fix - Resolution

The solution to this is converting the Lookup value to a string and then using it in workflow stages.

  1. Create a Workflow Local Variable named "country" of type "string".
  2. Modify the workflow by adding an if condition to check if the Lookup value is not-empty (is not empty).
  3. Set the variable to the Lookup Value
  4. Add further stages after the if condition. Add an else condition if required.
  5. Re-test

After modifying the workflow this way, even null/empty/blank lookup values will be converted to a blank string value.

Make sure you do this for every lookup column if you feel the value can be blank anytime.