Output of JavaScript

How to get the output returned by the JavaScript activity?

Execute Js component in Automation Studio, “Select Output” and assign the return value. Define the Output parameter in Parameter bar.

Refer Link for more details -

https://www.edgeverve.com/assistedge/knowledge-base/RPA19.1/Automation_Studio/Configuring-Automation-Processes/Process_Components/Execute_Java_Script/Execute_Java_Script.htm?rhhlterm=execute%20execution%20executing%20executed&rhsearch=Execute%20js

HI @sumit.sagar

I tried selecting the argument, but it is not getting the value of my java script variable.

Whether my argument name should de same as javascript variable name?

Hi @Mantri,

If you are using Chrome browser in your automation, you have to use return statement to pass the value out of javascript activity. It is not mandatory to have the argument name is same as javascript variable name. Here is the sample code.

Following script checks if the username control is present in the webpage and returns true or false as an output.
var isElementFound = “false”;
var usernamecontrol = document.getElementById(“txtusername”);
if(usernamecontrol!=null)
{
isElementFound = “false”;
}
else
{
isElementFound = “true”;
}
return isElementFound;

Hi @rajasri.muthaiya

Using the return statement I was able to capture the return value

1 Like