Hi,
When using activity ‘Invoke workflow’, some unexpected results come out regarding on the arguments value.
Studio: 2022.4.6 Enterprise
Dependencies: UiPath.System.Activities = 22.4.5
Here are the 2 sample workflows.
WK1: Invoke workflow WK2.
WK2: Only 1 activity, log message (String.Format(“in_1: {0}{3}in_2: {1}{3}in_3: {2}”, in_1, in_2, in_3, Environment.NewLine) with 3 in arguments.
Name | Direction | Argument type | Default value |
---|---|---|---|
in_1 | In | String | a |
in_2 | In | Int32 | 1 |
in_3 | In | Boolean | TRUE |
Issue 1:
When we want to update value for only 1 or some argument(s) in WK1 and leave the others as default value of WK2 (so that changing the default value in WK2 will apply to all invoked workflows), we should edit it in the Properties → Input → Arguments.
If we edit it via ‘Import Arguments’, those value of arguments you didn’t assign will be auto assigned as the default value in WK2. In such case, when you modify the default value in WK2 and execute WK1, the value of the arguments desired to be controlled by WK2 will keep the one in previous default value. For example, we assign “c” to in_1 only then click ok. in_2 and in_3 will be auto assigned as 1 and True.
Best practice: edit the arguments via Properties → Input → Arguments.
Issue 2:
When we would like to use the default value in invoked workflow, we’ll leave the value nothing in Arguments, shown as below.
However, the result will be:
Refer to Invoking workflows with empty arguments don’t get default values assigned - Help - UiPath Community Forum, it explains something but should it be documented well enough or an enhancement for better user experience? Since I’m not sure only type IntXX and Boolean have such issue.
Workaround: in WK2, if the value of in argument equals to the default value, assign the default value to the in argument.
I’ve search related topic in the forum and the bug fixed on 19.5 should be not relevant.
Looking forward for the discussion and feedback.