How can we dynamically load .xaml files in Invoke workflow File

I am trying to invoke.xaml files dynamically using Invoke Workflow Files. But I am stuck when passing arguments. For Ex: FunctionA has two Arguments ParaOne,ParaTwo, FunctionB has Two Arguments ParaThree,ParaFour.Now when loading dynamically following Error Thrown. If I declare arguments ParaThree and ParaFour in FunctionA and Declare Arguments in ParaOne,ParaTwo in FunctionB then workflow executing smoothly. That means all 4 Arguments need to be declared in all xaml files. Please help.
Message: The values provided for the root activity’s arguments did not satisfy the root activity’s requirements:
‘FunctionA’: The following keys from the input dictionary do not map to arguments and must be removed: ParaThree, ParaFour. Please note that argument names are case sensitive.
Parameter name: rootArgumentValues

Exception Type: System.ArgumentException

The thumb rule is the number of arguments must be same and datatype also should be same across workflows. You have two options

(a) Make sure all the workflows have same no of arguments , by adding dummy arguments

(b) You can have a single argument across workflows, in case of more than one argument, you can concatenate them before calling (use a separator like :wink: and split them inside the workflows. This is possible only if the datatype is string or number. You cannot do this for datatypes like array or dictionary…

E.g.

//Before you invoke the workflow
String arg1, arg2, arg3, arg;
arg = arg1 + “;” + arg2 + “;” + arg3;
//pass arg to the worklfow

//Inside the workflow, you should know the exact no of argments
String arrArg = arg.split(“;”);
String arg1, arg2, arg3;
arg1 = arrArg[0];
arg2 = arrArg[1];
arg3 = arrArg[2];

Note - the above one is just a logic, not the exact syntax

1 Like

Thank you Skini76 for your prompt response.
But bit confused.
Could you please explain me by taking one example, having Three arguments each in 2 XAML files and those files are called in main dynamically. This would be great help from you. I really stuck at this point.
In real time scenario, I need to read the set of Functions from excel sheet and execute from REFramework. Basically we are using Testing purpose. :slight_smile:

Thanks,
Imran.

You said “having Three arguments each in 2 XAML files”, the no of arguments are same, then what’s the problem ? Can you share your workflow and tell me what exactly the problem you are facing ?

XAMLParameterize.zip (21.8 KB)

Thank you once again. Please find the attached code and help.

Thanks,
Imran Khan.

I am not able to open the workflow and you haven’t mentioned what exactly the problem you are facing. So how should I provide a solution ?

image

Hi Skini76,
Thank you for your response. it is my bad that may be I have uploaded Developing Folder. How ever I have got solution, here I am attaching working folder. May be it will useful who browses this thread.
Note: After download,Only need to change the paths.NotePadActivity.zip (3.3 MB)

1 Like

Hi,
If your arguments are of primitive data types (str, int, bool etc.) then you could pass them using JObject argument type. I am successfully using this approach.

Alternatively you could use Dictionary(string,object) - like the Config “global variable” in REFramework.

Cheers

2 Likes

i have multiple library created in UIpath. can youll suggest me an approach to add these activities/nuget dynamically