Unable to capture out_Argument in Global scope even it's reference type

Hi all,

Since out_argument has to be a reference type, i.e array/datarow, etc. in case exception occurs at some point in the code, I am still not able to get the out_Argument out of the workflow where exception is.
out_Argument I am trying to extract from the workflow:

Initialized string of array in Global scope:

Invoked workflow’s arguments:

During the run, before the exception occurs, out_FilePath is populated with data:

As soon as an exception occurs and code goes out from the workflow, the global variable does not receive data from the out_FilePath:

What am I doing wrong? I read that argument must be a reference type, but for me - that does not work as well.
Any suggestions?
Thanks in advance.

1 Like

Hi @bp777,

I would suggest to use Try catch in that workflow, and pass a out argument boolean in the catch block.
Check if the boolean is true (To check error) outside that workfow and use throw activity. In this case values will be updated. Make sure you’re throwing exception in main workflow.

Hope this helps.

Do you mean to surround the Invoke workflow activity with try-catch?
I don’t understand why I should use boolean?

Not surround, inside the workflow use Try catch and inside that you use your activities. So if any error occurs it will go to catch. In the catch block you can use string out argument (for example: errorMsg) and pass the error message.
Assign errorMsg = exception.Message.

Outside the workflow check String.isNullOrEmpty(errorMsg) and throw error if its false.
In this case your all argument values will remain.

Don’t use Boolean. String is better, so that you can pass error message.

Can you share your project - or at least the 2 workflows involved? I think you may be using the IN/OUT variables wrong. I know I was confused the first time, and I was using them backwards.

The reason I ask, is b/c you do not need a global argument in the calling workflow for the OUT variable - only in the called - and I’m not sure which workflow each of these screenshots is from.