Problems to get input arguments using UiPath.Robot.api to start a job

I’m using UiPath.Robot.api.20.10.6 to build a program (.net 7) to manage and run processes following Robot API and every thing went well without input arguments.
But now I have a process needs a string argument named “in_runType” so I have add “job.InputArguments = new Dictionary<string, object>{[“in_runType”] = “test”};” to my code. But the robot returns an exception “cannot convert object to string”. After I change the argument type from string to object, I found I can only get a {“ValueKind”:3} from “in_runType.ToString()”.
I’m using UiPath Studio Community 22.10.4 on windows server 2019 dc.
I’d appreciate it if anyone has ideas to solve this problem.

Hi @max.wen.jiahao ,

Thanks for reaching out to community.

You need to cast the object value to a string type before assigning it to the “in_runType” argument. Use the ToString() method.

Try this : job.InputArguments = new Dictionary<string, object>{{“in_runType”, “test”.ToString()}};

The will make sure that the in_runType argument is string.

Happy Automation! :grinning:
Please do mark as a solution if it helps you. :writing_hand: :white_check_mark:

Regards,
@pratik.maskar

It works! Thank you!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.