Exception has been thrown by the target of an invocation in output panel


I was trying to group duplicate expenses and sum up their values using below invoke code

results = table.AsEnumerable()
.GroupBy(r => r.Field(“Expense”))
.Select(g =>
var row = table.NewRow();
row.ItemArray = new object
g.Sum(r => r.Field(“price”)),
return row;

But the error was thrown like"Invoke code: Exception has been thrown by the target of an invocation."

Please help me to resolve this issue

Hi @sangeethaneelavannan1,
From what I remember from my own invoke code experience is that unlike to traditional code for invoking you don’t need to return any data. You will be able to grab what is necessary from the code using Argument defined in activity properties.

As an example to your code:
Instead of return row you need to perform assignment like someVariable = row where this variable is defined as an output argument in properties for Invoke Code.