Returning an argument from an invoked workflow


I have read through numerous “Invoking Workflow” articles to no avail. I simply cannot figure out how to “return” a variable from an invoked workflow.

What I am doing can be compared to the following: calling a function and having it return a boolean.
In UIPath, this looks like the following: in main, invoking a workflow and having it return an argument to the main.

I can successfully pass arguments IN to the workflow but I simply have no idea how to get a value FROM that workflow back into the main.

I have tried the following: in the invoked workflow, I have created an ‘out’ argument called successCheck which determines if a certain action has occured. In the invoked workflow, I have a message that logs if is true or false. It happens to be true (as it is working correctly).

In the main, under IMPORT arguments, I also have that same ‘out’ argument called successCheck. I’ve also created this as an argument in the main.
In main, I have tried both reading successCheck directly (which always reads as false) and tried assigning a variable to successCheck (which also always reads false).

How do I use arguments to obtain a variable from an invoked workflow back to my main?


Welcome to UiPath community
You were almost done
But we need some small changes here
— once you have created the OUT Argument in the invoked workflow and accessing it I. The arguments property in the property panel of invoke workflow file activity, create a variable in the main which is of same datatype of the argument that we are going to get from that invoked workflow as a OUT argument
— so if the OUT argument is a Boolean type named out_successcheck from the Inivked workflow activity, then the variable that we have created in the MAIN should be of same type Boolean, named var_successcheck
— now while going for arguments property to get the OUT argument value from the invoked workflow to the MAIN then in the value field of argument property for that OUT argument out_successcheck, mention the value as var_successcheck
— now the value from the OUT argument out_successcheck will be assigned to the variable var_successcheck
— so now we can use this variable var_successcheck which holds the value of the OUT argument as either TRUE or FALSE, anywhere in the main workflow

Simple isn’t it
Hope this would help you
Kindly try this and let know for any queries or clarification

Cheers @Helbinobear


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.