Hi everyone!
I tried to search, but didn’t find the answer.
I added “Inject js” to my activitie and my js code makes array as output, but Ui changes it to string.
How I can get array?
Thank you in advance!
Hi everyone!
I tried to search, but didn’t find the answer.
I added “Inject js” to my activitie and my js code makes array as output, but Ui changes it to string.
How I can get array?
Thank you in advance!
Sorry could you please explain that conversion part what is happening.
If possible with screenshots.
Thanks
#nK
Hi @Akobir,
According to Inject JS Script activity documentation, it is only possible to return String.
But, you can try a workaround…
Instead of returning your array, try this:
return JSON.stringfy(yourArrayVariable)
Then, you just need to Deserialize it:
If you need more details, let me know.
Kindly mark this answer as solution if it helped you.
Hi, Gustavo! Thank you for your answer, it was very helpful!
Maybe you have any example of workaround?
Thank you for your answer! I’ll try to use Gustavo’s workaround.
Gustavo, thanks!
I found the example in uipath docs, but I can’t find deserialize activitie.
If it possible - can you help me with this, pls?
@Akobir, check it out:
InjectJsScriptReturningArray.zip (3.1 KB)
Note: You must install UiPath.WebAPI.Activities dependence
Thank you very much!
And else one question - how I can get a value from deserialize array?
For example, I have array with 2 columns
[
“result1,
result2”
]
Can I get “result2” to messagebox?
Hello @Akobir,
You’re welcome
Yes, it is totally possible.
You can use Split, considering that you have an array of String where each item is separeted by comma.
Check the updated solution if necessary
InjectJsScriptReturningArray.zip (3.3 KB)
If you need extra help, let me know
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.