How to reuse Terminal Connection

OutputConnection: optional, one may specify an output variable (of type TerminalConnection) in order to be used later in other terminal sessions.

How to use terminal connection in another workflow.
i have created a variable in outconnection and passed it to existingconnection of another terminal but its not working, any help on these??

1 Like

Hey,

What does the error say and do you have any screenshots? As far as if there is a problem with UiPath passing Terminal session variables as arguments, that I am not sure about. But, if it’s an issue with your code maybe I can help.

If terminal variables indeed can not be passed, then a workaround is to pass the connectionstring as a string. You can pass that by doing terminalVariable.ConnectionString

Regards.

1 Like

Hi Claytonm,

then a workaround is to pass the connectionstring as a string. You can pass that by doing terminalVariable.ConnectionString
Can you brief on these topic with example if possible.

Thanks
bharath

These the error which i am getting i have tried to pass the out connection variable to workflow but its not working.

“message”: “Terminal Session Faulted”,
“level”: “Verbose”,
“logType”: “Default”,
“timeStamp”: “09:13:46”,
“processVersion”: “1.0.6659.21423”,
“fileName”: “Terminal_1StepLogin”,
“jobId”: “7200e74e-7a0e-4abc-bd91-b649b8abc029”,
“robotName”: “CSCADMIN”,
“activityInfo”: {
“DisplayName”: “Terminal Session”,
“State”: “Faulted”,
“Activity”: “UiPath.Terminal.Activities.TerminalSession”,
“Arguments”: {
“ConnectionString”: “”,
“DelayMS”: “1000”,
“TimeoutMS”: “50000”,
“ExistingConnection”: “”,
“ContinueOnError”: “False”,
“OutputConnection”: “”
}

1 Like

Hi,

From the error, it shows that your ConnectionString is empty. Make sure you have set the right properties for your connection. If you are passing terminalVariable.ConnectionString as an Argument to a string variable in your workflow, you will need to place that variable in the ConnectionString property shown in the below screenshot:
image

Hope that helps.

Regards.

1 Like

Hi ClaytonM,

Thanks for guidance ,as i have problem with passing my existing connection to another terminal through a variable using existing connection property.

But finally i have successfully passed the existing connection to other terminal session :slight_smile:

@balu
Can you please help me how did you pass existing session to invoked workflow.
I am having similar issue and i am not able to resolve it.

Hi @Nilesh

At the first terminal session it will creat a connection string then you can create a variable for output connection property in that connection and make use of the variable when ever you are passing the connection.

Regards

Bharath

Hi @balu
How did you achieve to pass existing connection to other workflow?
Thanks,

In my case OutputConnection variable comes null so I can not pass it to other workflows. Do you mean using both output connection variable and connection string together?
Thanks,

@RSalamow yes at first you need to provide connection string and create a variable in output connection property, next where ever u need these connection u can pass this variable to existing connection property.

Thanks

@balu I somehow have the same issue as @RSalamow.

I establish a connection in Main.xaml, and then i create a variable within OutputConnection. This variable is passed to an argument (another .xaml) where I want to continue the proces within the same terminal session. So the argument is inserted into ExistingConnection.

But when the robot comes to execute the terminal activities, I get the error: Terminal Session: No connection specified

Note that the CloseConnection is checked by default :face_with_raised_eyebrow:

Link to documentation

Hi Clayton,

I tried what you suggested; passing in the connection string. This just starts up a new terminal session on my system.

Thoughts?

Thanks,

Carlo.

You should be able to pass the TerminalConnection variable as an argument and connect to existing sessions. Make sure you update to latest Terminal activity package first.

Also, ensure that you are using the correct direction for the argument, as that will cause the argument to be null when invoking a workflow or Library. Basically, it should be IN/OUT or OUT where the session is initialized and opened so it can attach to it. It should be IN everywhere else.

Your Login part should check if the TerminalConnection is not null using condition:
tc is Nothing

If true, then create session using connection string. If False, then use ExistingConnection property and navigate screens to main menu if wanted.

I am using the latest package (v 2.3.0).

In the other thread we’re in I’ve posted more screenshots that show all the arguments, variables, etc. We might as well just communicate through that one to save all the back and forth :slight_smile:

Thanks,

Carlo.

You have CloseConnection checked in the first Terminal Session activity that outputs the connection to tc. Uncheck that box. Make sure it’s not checked in any of your Terminal Session activities.

1 Like

Thank you. For the benefit of those following this post, I’ll repeat what I said in the other post…

I didn’t realize the OutputConnection parameter isn’t populated until AFTER the Terminal Session activity is finished.

Thanks for your help,

Carlo.

1 Like