top of page

Understanding and use case of Global Variables and Constants

What is Global Variables and Constants

Global variables and constants are the most important feature that is newly introduced by UiPath 2022.10. They allow you to store data in a central location that can be accessed by all workflows/activities of your project. You can identify them easily by using the global keyword. For example, if you want to use the global variable Config in your Sequence/Project, you would write: global_config, If you want to use a constant, you would write: constant_(Name of the constant)

When working with data in a workflow, it can be helpful to have the ability to share data between the different activities in the workflow. This is where global variables and constants come in. Global variables and constants allow you to store data in a central location that can be accessed by all the activities in your workflow. This means that you don't have to pass the arguments for this. There are a few things to keep in mind when working with global variables and constants. First, you need to make sure that the variable or constant is actually defined before you try to access it. If the variable or constant is not defined, you will get an error. Second, you need to be careful about how you modify global variables and constants. If two activities in the workflow try to modify the same variable or constant at the same time, you may end up with unexpected results. Overall, global variables and constants can be a helpful way to share data between different activities in a workflow.

When working with data in a workflow, it can sometimes be necessary to share that data with another workflow in the same project. With global variables and constants, this is possible without having to pass the data as an argument. This can be extremely helpful when working with large or complex data sets that would be difficult to manage if they were passed as arguments. It also allows for greater flexibility when working with data in a workflow, as you can easily access and modify global variables and constants as needed. When used properly, they can save time and simplify the process of sharing data between different workflows.


Let’s have a look at how to Create/define Global Variables and Global Constants in UiPath Studio stepwise:


Steps to create a Global Variable:

Step 1. Open the Data Manager from the right-side panel of your UiPath Studio




Step 2. Look for Variables, and under variables click on New Variable. Data Manager > Variables > New Variable.


























Step 3. Then fill in all the fields as per your Project requirement.











Step 4. To make this variable a Global Variable you need to change the variable scope from Main to Global.











Your global variable is created successfully, pass this global variable in the activities to use the variable throughout the Project.









Steps to create a Global Constant:



Step 1. Open the Data Manager from the right-side panel of your UiPath Studio.



Step 2. Look for Constants, and under constants click on New Constant. Data Manager > Constants > New Constant.

































Step 3. Then fill in all the fields as per your Project requirement, and click ok.













Your global constant is created successfully, pass this global constant in the activities to use the constant throughout the Project.









16 views0 comments

Recent Posts

See All
bottom of page