How do I pass argument from .net code to OpenRPA?

var rparesult = client.InvokeOpenRPA("123456789",
"1234566", "{\"test\":\"test\"}", true, 60);

How can I send the argument “test” from .net code to this OpenRPA argument. Currently, when I run my code, the workflow is successfully invoked, but the argument is not passed. Did I miss any steps?

That looks 100% correct. So that is a little odd.
Can you check you didn’t by accident also create a variable called test too ? those will override the arguments.

The variable is empty. The “test” is at argument tab.

In my experience you cant access arguments with C# code. What i do is copy them to a variable before the code and then back to the argument after the code.

@Morphyum I think @hw.chan is using either Rust, DotNET, or Java (since most other languages use .invoke_openrpa as the call signature).

Well, a common issue I see is people mixing casing (lower and upper case), and arguments are case-sensitive. But from your example code and screenshot, all looks like it is lowercase. You did edit the example code (the IDs do not look valid), so just to be safe, can you please confirm you also used test with lowercase when calling InvokeOpenRPA?

Yes. I am using dotnet and the only part I edited is the workflow ID and robot ID, the payload string remains the same as shown above, all lowercase.

Usually this will directly insert into argument tab? or do I need any extra element to map into it?

No, this is EXACTLY what i do in my unit test’s as well, and never had any issues.

So the RIGHT workflow run’s, but the test argument is empty , correct ? How do you check, do you have a WriteLine or did you set a breakpoint with F9 ? Keep in mind the variable inspector in OpenRPA can only see variables, not arguments so you need to re-assign it, or use writeline to “check” those

This is the example I try to test for the argument. I try to use writeline but got nothing.

image

The return value i get is {“test”: null}

Wait, that is interesting, so you DO get test back?

Can you add an Assign activity and assign a value to test? Do you see that in the response inside C#?

This is example when I assign “abcd” to test.

image

The return result from InvokeOpenRpa in the code is abcd

but the “test” in argument tab is still empty

This makes no sense. If you can SET the variable, then you must also be GETTING the value sent. So either your C# code is not sending a payload (or it has errors) or you are not testing the right way for the value you’re getting. Could you please remove the Open URL activity and ONLY have WriteLine and Assign. In WriteLine, put

"test argument: " & test

and in Assign, keep it like it is in the screenshot, with test in the left field and "abcd" in the right field.

Then call

var rparesult = client.InvokeOpenRPA("123456789", "1234566", "{\"test\":\"test\"}", true, 60);

And in the output tab in OpenRPA, send a screenshot with the line that should say

test argument: test

or

test argument:

this is the result

That makes no sense to me :face_with_raised_eyebrow:

Everything is exactly like it’s supposed to be.
I want to ask for the C# code, but you already told, you have "{\"test\":\"test\"}" for the payload, so that is also correct.

I need to double check all of this still works for me, but I cannot do that until tomorrow … Will post again after running my own test one more time.

Ok sure, I will wait for your update. Thanks for your help!

This is maximum embarrassing …
In my test, i never looked at the data the robot received i only looked at what i got back.

I have been sending data the wrong way, all the time, it’s a single line fix, but will take me a while to prepare pushing an updated package. Hopefully i will have it all ready by the end of this weekend.

1 Like

Sure. Please let me know after you update the package.

Done. A version 0.0.39 has been pushed out now .. i will be pushing a new version again within a day or two to fix a few issues. There is a bug in delete_many for nodejs, watches seems to have issues in dotnet and I’m not done testing everything about the new system where the client libraries only download the binaires needed ( before we would bundle them all ).

1 Like