Made a bot that relies on local filepaths, wanting to run it from assistant after publishing to orchestrator

Hi guys,

I’ve published my bot to Orchestrator, and it is heavily reliant on local filepaths for creating excel sheets and such. I want to publish the bot to orchestrator so it can be ran via the assistant, but after I publish it the file paths seem to re-adjust to those in orchestrator instead of my local folder which causes the bot to break.

Does anyone know if its possible to publish the bot to orchestrator (for governance), but keep the filepaths local/allow for me to trigger the bot via assistant?

Hello,

You have to enable the bot to resolve the local paths automatically based in it’s environments.

You can look up the Environment variables activities to see how you can do that.

For example if you have located your work folder in your Documents folder, it is obvious that the bot will break on another machine because the Documents folder path is different for each user.

Therefore you have to have your bot resolve the “full path” or absolute path to your Documents folder and then specify the full path in your activities in the automation.

This is how it might look like:

First get the path to Documents folder (on any machine) by looking up the appropriate environment variable and assign it to a variable say “sBasePath”

Next in your file activity (example Write to File) , specify the full path by using the base path above:

Path.Combine(sBasePath, “myFolder\someFile.txt”)

Now, this approach would work if you know for sure users are putting their folders under a standard folder such as Documents. But what do you do it a user wants to put their folders in a non-standard location?
For example: C:\MyFiles\MyReports

In this case you can have your automation accept input arguments to main.xaml so that users can pass in the base file paths as inputs the the Automation either from Orchestrator (if automation is unattended) or the UiPath Assistant (if automation is attended).

Thanks