Cannot cast LValue expression to type Microsoft.Activities.DynamicValue error in visual studio workflow in SharePoint

This SharePoint tutorial, we will discuss, how to fix error Cannot cast LValue expression to type Microsoft.Activities.DynamicValue which comes in SharePoint Online visual studio 2015 workflow.

We were developing a workflow for SharePoint online site using visual studio 2015 as a SharePoint hosted add-in.

The error comes as:
Failed to translate expression because of the following error:
Cannot cast LValue expression to type ‘Microsoft.Activities.DynamicValue’

The error looks like below:

Cannot cast LValue expression to type Microsoft.Activities.DynamicValue

Cannot cast LValue expression to type Microsoft.Activities.DynamicValue

Here in this workflow, we have used one variable as string type like below:

Cannot cast LValue expression to type Microsoft.Activities.DynamicValue

We have used this variable in calling in the rest api in HttpSend activity. The error was coming because in the HttpSend it was expecting a variable of type Microsoft.Activities.DynamicValue<T>.

So to resolve the issue, change the data type of the variable from String to Microsoft.Activities.DynamicValue<T> like below:

Cannot cast LValue expression to type Microsoft.Activities.DynamicValue

You may like following visual studio workflow tutorials:

This tutorial, we learned how to solve Cannot cast LValue expression to type Microsoft.Activities.DynamicValue error in SharePoint visual studio workflows.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>