BPM Code Calling Function/Tuple - Cannot convert type 'object[]' to. .

Hey there,

I’m trying to call a function from a BPM inside an updatable query.

Here’s the function signature:

And the code trying to access it:

var result = (Tuple<System.String, System.String, System.String>)this.InvokeFunction("ScheduledTesting","AltCITests",inBusUnit,inCINum,inCIRevisionNum,inSysRowID);

I’m getting the error “Cannot convert type ‘object[]’ to ‘System.Tuple<string, string, string>’”

If I comment out the “result = . . .” and execute only:


The function runs fine but doesn’t return anything, of course.

What am I missing?



Not Sure if you already have this - but here you go:

var result = (Tuple<bool, Decimal, String>)this.InvokeFunction("InterCompanyShip", "CheckMatching", Tuple.Create(ttr.ShipHead_PackNum)); 
bool return1 = result.Item1; 
decimal return2 = result.Item2; 
string return3= result.Item3;

Hopefully this helps
Kind regards

var result = (Tuple<int?, DateTime?>)(this.InvokeFunction(functionLibrary, functionName, Tuple.Create( today, leadDays, "STLMFG")));

Am I crazy? I’m still getting the "Cannot convert type ‘object[]’ to ‘System.Tuple<int?, System.DateTime?>’ - that is the correct data type return value from my function signature.

Most of the Tuple stuff is no longer necessary.

object result = InvokeFunction(functionLibrary, functionName, today, leadDays, "STLMFG");

result[0] is your int
result[1] is your datetime

1 Like

Thank you so much, you have saved my sanity.

The reason for the previous error was that for DateTime types, you have to type out System.DateTime? instead of just DateTime?. No idea why.