Global Variable

How to create global variable and use through the multiple workflows?

I’ve created dictionary(Of String, Object) and pass it across my xaml’s as In/Out argument.
This way I can access all dictionary entries across all my workflows and all edits to the values are also available.

3 Likes

Hello!

To use variables through workflows, you just have to pass it as arguments in “Invoke workflow file” Activity (Arguments property).

Hope It Helps!

Regards,

3 Likes

Ultimately you should be using Orchestrator which allows you to create assets and credentials which can be used throughout multiple processes. Of course this comes with price :smiley:

I have the same question.
If I want to use a variable in 50 workflows, it is a very tedious job to pass it argument to the next 49 workflows. Is there any way that I can use the global variable in all my workflows without passing it as argument?

1 Like

Is there any other way? Like can this be done with flowcharts or state machines?

@bristighosal910 a good idea as an improve to usability for workflows could be to automatically assign as input variables when you import if you have them in the context with exactly the same type and name.

Anyways workflows are similar to functions and probably don’t even have to be part of the process itself since you can use them through multiple processes so… using global variables… its an option but not a best practice

Okay, Thank you.

You might consider to use Environment variables stored in the current process.
The are accessible through the Get Environment Variable activity or inline, like: Environment.GetEnvironmentVariable("Domain")

You can set them with an InvokeMethode activity, e.g:
image
SetEnvironment.xaml (7.1 KB)

Note: you can only globalize String type variables this way

3 Likes



are all same, guys please vote one another (to bump this) as its a good feature

This is different from the “using argument passing for a global variable” because that is just passing around the variable copy which is exactly what this idea wants to avoid

6 Likes

You could define a custom .NET type, maybe a static class with public (static) fields and properties. This class could be initialized when your workflow starts, and the values are then accessible throughout all workflows via the static interface. This class might even be smart enough to initialize itself from the config file. Like any custom type, you would need to bring it into UIPath via the package manager.

Can there be a global variable which can be accessed across workflows in a project without passing as argument in workflows

Hello there,
It’s been proposed already. :slight_smile:
However you could do via dictionary or Orchestrator assets .

2 Likes

i am currently using assets or dictionary. but as a framework when i try to fetch all values initially it requires passing them as arguments across workflows. else i need to access asset in each workflow

1 Like

Hi,

you can use this component to set your variables globally. it follows the pattern declare once and use anywhere in the project. This component supports all data types supported by UIPath.

Thanks,
Manoj Batra