cancel
Showing results for 
Search instead for 
Did you mean: 

Sending attachment from online service

PatrickPerea
Level 3
Hello,

I am new to blue prism and I am running into an issue that I need assistance one.  What I am trying to do is log into our financial database process a report and have it emailed as an attachment.  The attachment is created in .xlsx format and placed into the download folder. 

I have the report creation done in the template but I am running into the issue where the attachment is not being attached.  

The report file name is Investment Value_2022-12-12h10m30s42.xlsx    with everything after the investment Value is different.

I tried using get files with the CSV "Investment Value*.xlsx" but that had the collection blank.   I made a collection of the file path and put [File_Path]&"Investment Value*.xlsx" but I get the error that file was not found. 

I am using the Microsoft Outlook VBO as the process to email.  To ensure I had that set up correctly I remove attachments and everything runs and email is sent.

Any help would be appreciated. 

1 REPLY 1

ewilson
Staff
Staff
Hello @PatrickPerea,

You won't be able to use wildcards when passing the file information into the Outlook VBO. You must provide the actual fully qualified path and file name. If the name of the file changes, you'll need to add some logic to your process to determine the name of the file. You can use the Utility - File Management VBO to work with files and file paths. ​As an example, you could use the Get Files action to return a Collection of files in the folder that match your search criteria (ex. Investment Value_*.xlsx). From there, you would need to have logic to decide which of those files actually need to be attached to the email and then you would append each fully qualified file name/path onto a Text data item (each file is separate by a semicolon if there are multiple). That Text data item is what you pass into the Send Email action for the attachments.

Here's an example of the logic for getting file names and adding them to a Text data item. In this case I'm checking a folder where I have 3 different .XLSX files. The names of the files are DataInsurance01.xlsx, DataInsurance02.xlsx, and DataInsurance03.xlsx. In this example I just want the file named DataInsurance01.xlsx to be used as an attachment, so I use a Decision stage (inside of a loop) to check the name of the files that were returned from Get Files. That Decision stages uses the EndsWith function to see if the current file name ends with "01.xlsx". If it does, the full path of the file is added to the Text data item named Attachments. Then I can pass that into the Outlook VBO.

35179.png
35180.png
35181.png
35182.png
Cheers,
Eric