Reputation: 525
How can we pass Array as an input argument when we start a job using API?
Background:
I'm working on a react project and with a button click, I want to start a job with inputs. I know that we can pass an argument as
"InputArguments": "{\"message\" : \"hello\"}"
I'm populating an array in React and want to pass it to the process as an input argument. Following is my uipath code
I've tried doing the following in React project
const messagesList = ["message1", "message2", "message3", "message"]
InputArguments: "{\"messages\": \" "+ messagesList + " \"}"
but when I click on the button and the job starts, it gives me the following error
When I set the argument in orchestrator and start a job through orchestrator, it works fine
Can someone please help me with it?
Upvotes: 1
Views: 753
Reputation: 525
I figured out the solution. The list has to be in JSON format In react it will be like
const msg = {
messages : [
“message1”, “message2”, “message3”, “message4”
] }
And then use JSON.Stringify to convert it to JSON
InputArguments: JSON.stringify(msg)
Upvotes: 0