There is a particular scenario in which you might receive below error if using SharePoint Designer List Workflow.
Coercion Failed: Unable to transform the input lookup data into the requested type.
Consider a SharePoint list called "Employee" with following schema.
Employee Name (Text)
We create a SharePoint Designer workflow to send a simple email with Employee Name and Country when an item is created.
Though the workflow is pretty simple. We note that it worked fine where lookup values are United Kingdom, United States, Spain, Australia, but fails when the lookup value is blank. It gets 'Canceled' in this case.
If we look 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.
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.
The solution to this is converting the Lookup value to string and then using it in workflow stages.
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.
Code2care'smission is to share varied knowledge in technical and non-technical areas gathered during day-to-day learnings and development activities so that our visitors can leverage this portal to find solutions to their queries without re-inventing the wheel. Technical posts include Learnings, Tutorials, Video Tutorials, Code Snippets, Tips-n-tricks.