How to Use Arguments and Inject JS Script in UiPath: A Complete Guide
UiPath is an advanced automation platform that facilitates developers and coders in automating tasks like web scraping, data extraction, and even web automation with the use of JavaScript. Here are two examples of major UiPath functionality that can make your process automation more efficient: the usage of the Arguments and the ability to Inject JavaScript into web pages. In this blog post, we will try to delve into these two features and show how to make effective use of them.
1 How to Use Arguments in UiPath
In UiPath, Arguments are the variables that allow you to pass data between workflows or activities. Arguments can be defined and treated as input information or output information of the activity/workflow.
The correct use of arguments adds to the ability to redesign and reuse workflows and also the flexibility of automation projects.

Types of Arguments in UiPath
- In – Used to insert data into the workflow.
- Out – Used to retrieve data from the workflow.
- In/Out – Used to both transfer data to and return back data from the workflow.
Steps to Use Arguments in UiPath
1. Defining Arguments

To define an argument in UiPath:
- Begin the workflow by specifying the argument.
- In the Variables panel, click the Arguments tab at the bottom.
- Click Create Argument to create a new argument.
- Enter the name, direction (In, Out, In/Out), and the argument's type, such as String, Int32, etc.
2. Using Arguments Inside the Workflow
Once you outline the args, you can use them in activities. For instance:
- Assign Activity: You can pass a value to an In argument.
- Write Line or Message Box: You can use an Out argument to display data, which is the data that the workflow produced.

3. Passing Arguments to the Other Project Workflows
It is possible to pass arguments from one workflow to another via invoking workflows. For example:
- Call another workflow and bind arguments through the Invoke Workflow activity.
- In the Properties tab, at the right side locate Arguments of Invoke Workflow activity. There you can map the arguments between the caller and the invoked. Workflows.
Example: Passing Data Between Workflows
Say, for instance, you have a couple of workflows:—MainWorkflow.xaml script and-like SubWorkflow.xaml. You would like to transfer a string argument to SubWorkflow.xaml and receive a string in return.
- Define an Input argument (e.g., inputMessage) in SubWorkflow.xaml.
- Then, in the MainWorkflow.xaml, make a variable that will store the Out argument (e.g., outputMessage) to hold the result.
- Then, in Invoke Workflow activity, give the inputMessage from the main workflow to the argument in the sub-workflow.
- The value in outputMessage will then be accessible
Lucille
An effort offers a chance to learn, and a result provides valuable lessons.
