I am connecting the terminal session using direct connection type method, In this i am unable to disconnect the terminal session for retrying. Unable to pass the session to another task or xaml. please help me how to do disconnect the terminal session?
To disconnect a terminal session in UiPath, you can use the “Disconnect Terminal Session” activity. This activity allows you to disconnect the current terminal session, which you can then use to retry or pass the session to another task or XAML.
Here’s how to use the “Disconnect Terminal Session” activity:
Add the “Disconnect Terminal Session” activity to your workflow where you want to disconnect the session.
In the “Session” field, select the session that you want to disconnect. You can use a variable or an expression to specify the session.
If you want to wait for the session to disconnect before continuing with the workflow, select the “Wait for session to disconnect” option.
Click “Save & Exit” to save the activity.
Once you have added the “Disconnect Terminal Session” activity, you can use it to disconnect the session and then retry or pass the session to another task or XAML.
Actually what happen here, i used the terminal connection type as direct connection so while running the code the UiPath itself opens the terminal in executor window due to this unable kill the process , disconnect the session and share the session to another xaml .
Please find the below screen shot connection type what i used.
The session variable is not being passed correctly to the “Disconnect Terminal Session” activity. Double-check that the session variable being passed to the activity is the same variable that was used to establish the terminal session.
The session might have already been closed or disconnected by another activity or process. In this case, you can use a Try-Catch block around the “Disconnect Terminal Session” activity to catch the error and ignore it. This will prevent the error from stopping the execution of your workflow.
I have given the correct variables and mapped properly still having same issue.
As you mentioned in 2 point , i have given terminal disconnect code inside the try block only. Actually I have kept the entire code inside the times loop . For every retry the bot is creating new session and didn’t disconnect the existing session.