I’m playing around with the new code source files in UiPath Studio. I’ve created a new class called ProcessConfiguration and I want to create a global variable of that type. Unfortunately, when creating a new global variable the namespace is there, but it’s empty.
I can create a variable of that custom type (ProcessConfiguration) in any of the sequences, and it works fine. It’s only in the Global Variables section that this seems to be blocked.
Some screenshots for reference:
When creating a variable in any of the sequences
When creating a global variable
The same section of XXXX.REFramework.Hybrid.Core is expandable when creating a variable in a sequence but locked for the global variables
I tried:
closing and reopening the project
closing and reopening the UiPath Studio
restarting the whole PC just in case
manually altering the globalVariables.json
Is there any way to get UiPath Studio to recognise and display these classes?
By definition of coded source file…I dont think global declaration is possible…as coded source files are valid at the individual xaml levels and not at the global level…
I’m not sure I can agree with that “not by the definition” part though.
In the docs (your link) there’s a line that says “they [the coded source files] function within the context of a project” + “consistent structure throughout the project”.
Global variables are withing the context of the project too and therefore, by the definition, it should be possible.
On top of that:
the type picker in the global variables section displays the assembly, so it knows it’s there. It just doesnt display the types that are within.
global variables are actually capable of handling the custom types if you disguise them as Object. I’ve tried setting up a generic global variable
then assigning a value to it (of my custom type)
and then, within the child sequence, printing it (with a type cast)
and the result is correct
So yes, it doesnt seem to be supported at the moment but, both by the definition and by the current behaviour it seems that it should be.
I’m currious to hear from the UiPath team if there’s a workaround for that or at least what’s the rationale behind that constraint.
@Filip_C the code source namespace seems to function correctly after this project settings update. However, the potential trade-offs are not yet clear to me.