Passing workflow arguments from a dictionary instead of setting in the GUI

Is there any way to pass a dictionary of arguments, and get UiPath to expand it and pass to the invoked workflow - rather than hard coding them individually? For example, I may have an invoke activity inside a loop calling a different workflow on each iteration. Each workflow has a different set of input arguments so I would need to change it each time based on values in a datatable. So I need to somehow set the ui:InvokeWorkflowFile.Arguments values programmatically, rather than using the invoke workflows’ arguments gui. Ideally I’d just use a dictionary with arguments assigned as key-value pairs, but don’t know if this is possible in UiPath.

Anyone here done something like this successfully?

1 Like

Hi there @pduffy

Of course its possible with uipath to store variables as key value pair in dict.

Create/declare/initialize a dictionary as required with key values and keep updating them using add to dictionary activity or using assign statement to update the value with the same key for dynamic allocation.

I am writing this assuming that you should update some packages for the add to dict. activity. Or else you will have to use the usual syntax in an assign activity to add values (key value pair)

Just pass the dictionary to the workflow in question and there you have it, a dynamic non GUI variable at your beck and call.

Regards :slight_smile:

1 Like

Thanks @Raghavendraprasad I know how to pass a dictionary as an argument but that’s not what I meant. The problem is the workflow that gets called will be changing on each iteration of a loop, so the number of variables and their names will be different each time. I don’t want to make every workflow use a dictionary as it’s input as it is sloppy and hurts re-usability. What I’m looking for is a way to expand a dictionary of variables and pass them to the relevant arguments in the invoked workflow. I guess you could consider it a bit like the **kwargs feature in Python. When we use the gui in UiPath it adds the variables to the .xaml as shown in my original post, I am wondering how to do this from within the robot itself.


Do you want to pass all the arguments from the Dictionary for all the xamls?

I want to have a workflow in the middle of a loop. The workflow path will change on each iteration depending on values in a datatable, and therefore it will need a different argument list each time. So at the moment I have to hard set the argument names and values through the gui, which doesn’t allow me to do what I want. I could use a dictionary dictionary to set the argument name-values but any other way is fine too, if anyone has a solution.


Using dictionary is the best option. If you have multiple values in a single arguments then go for DataTable, else use Dictionary.

I don’t think anyone is understanding my question.


Let me put it this way. Tell me whether I am understanding you well,

  1. Your ‘invoked xaml’ itself changes which is being called in the middle of another execution (possible a main or a parent xaml)
  2. The list of arguments change for each xaml and you dont want to set it in the GUI (literally mapping the arguments for each xaml that is called or build different split workflows for the same) or pass it in a dictionary (you need the dictionary with key-value pars also to be dynamic)

This is what I understand from the above conversation - if I am wrong please explain it again like you do to an 8 year old :wink:


Thanks @Raghavendraprasad,

That’s it. The invoked workflow changes (as in - it’s a different workflow each time). The problem is the workflow that is invoked will have variable arguments (names, types, number of arguments). I cannot just pass a dictionary to it because I can’t make every workflow take a dictionary as it’s input. So I didn’t understand this suggestion “Just pass the dictionary to the workflow in question and there you have it, a dynamic non GUI variable at your beck and call.” … maybe I need the 8 year old explanation of this :o)