[Help] How to Use a Variable Value in "Invoke Script" in OpenRPA?

I’m currently working on a workflow in OpenRPA where I need to use the “Invoke Script” activity to type a password into a web input field. The password is stored in a variable (for example, myPassword), but I’m not sure how to access or pass this variable inside the JavaScript code of the Invoke Script.
How do I properly pass the value of myPassword to the script above?

I would really appreciate it if someone could explain how to bind or use OpenRPA variables in the “Invoke Script” activity.

Yeah, that is a little tricky.
You are basically sending a string with the script, so you need to concatenate the password into the string. Create a string variable, let’s call it script, and use that in the Script property of Execute Script. Let’s say your password is in a variable called MyPassword.
Then you can do something like this using the Assign activity. In the left field, type script, and in the right field type something like this:

"let el = document.getElementById('passwordfield');" & _
"el.value = '" & MyPassword & "';"

It’s not working. here, I am using invoke script and write the script into this not using assign activity.

then it’s not possible. There is no “parsing” of the script that can inject variables. So you need to do it the way i told you to, if you want to make it work.

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