Sorry, a bit of a rookie question here. I have searched both on the forum and Google, but can’t find any answer to this issue.
I’ve set up an automation which goes into Salesforce and downloads a daily report. The report always saves with a new random file name (report + random number.xls). I want to create an automation which picks up the daily report, attaches it to an e-mail and then sends it off to a number of people.
Because I don’t know the file’s name before the automation starts, I’ve set it up to look through the folder where the report is saved and then pick the newest file (I got help to do this from a different thread on this forum). The way I do this is by:
Assign: directory = new DirectoryInfo(“C:\Users\username\Downloads”)
Assign: last_mod_files = directory.GetFiles("*.xls").Where(function(file) file.LastWriteTime.Date= DateTime.Now.Date).OrderByDescending(function(d) d.LastWriteTimeUtc).ToArray
Assign: MyExcelFile = last_mod_files(0).ToString
When I try to print MyExcelFile to the console it returns the correct filename. So far, so good. However, my issue is that I don’t know the next step from MyExcelFile = last_mod_files(0).ToString to actually getting that file attached to an e-mail.
I know the Outlook activity and how to make UiPath attach a given file if you know the file path and name before the automation starts. But in this case I can’t put in the file path before the automation runs, because the file doesn’t exist before the automation is run.
I hope someone can help me with this.