RPA – Automate Document Publishing and Dissemination
Outline
- Background of the Use Case – What are we doing?
- Automation Plan – How should this be done?
- Dependencies and General Setup – What will I need?
- Attacking the Problem – How will this be done?
Background of the Use Case – What are we doing?
This sample automation will demonstrate a simple task automation process and the integration of UiPath, MS Office and Adobe PDF.
The business process improved via this automation is a purposefully simple series of tasks intentionally crafted to represent basic office tasks. The general task steps are as follows:
- The user finishes reviewing a set of word documents in a folder. The user creates two folders: an archive folder for the draft word docs, and a dated folder for final reports.
- The user renames file without “draft”, “working”, “v2”, or any other temporary words and saves it as a PDF in the FinalReports folder.
- The user files all original word docs into the archive folder.
- The user emails all completed PDFs to a distro list with a message indicating the date/time of the reports.
Automation Plan – How should this be done?
Goals for this automation were as follows:
- Verify finished reports and create new subfolders
- Convert all finished reports (word docs) into PDFs with proper names and move files to subfolders
- Email all finished PDFs to designated recipients with a short message and confirm to the user via email
Dependencies and General Setup – What will I need?
This automation mostly uses generic capabilities and packages of the listed platforms, with UiPath.Word.Activities as one exception. UiPath originating packages are generally simple to add via the studio package manger when searching by name. (see figure 1)
This entire automation runs from UiPath Studio, requires application versions of MS Word and Outlook. Development of the entire automation took less than four hours. As a basic automation, there are many improvements and functions that are viable additions, allowing this type of process to grow and scale.
Attacking the Problem – How will this be done ?
Reviewing the process steps and automation goals above leads to three automation steps in our workflow:
- Create New Folders for archive and final reports
- List Files and convert into PDF
- Disseminate Reports via email with a short message
Each automation step shall conduct one related set of operations (roughly a class, in codespeak). For studio, each set of operations lives within a sequence, basically a container of related actions intended for sequential operation. (see figure 2) In the steps below, each automation sequence is described with corresponding Studio screenshots.
Sequence 1: Create New Folder
The trigger for the user to activate this automation is the completion of the report review. When the user runs the automation, the very first step is a popup dialog asking confirmation of the user’s working folder. The user may keep the default folder location or browse and select a new one. “WorkingFolder.txt” is a configuration file with the default workspace, allowing the user to permanently update their default folder or use a different directory ad hoc. Of note, text/CSV files with configuration data and settings are a best practice with UiPath and highly recommended. (see figure 3 and 4)
After the user has chosen a new or default working directory, the folder architecture is setup (see figure 5). The SOP for the final reports folder will have a DAY-OF-YEAR_dd-MMM-yy format, accomplished with the following line of UiPath native string manipulation: DateTime.Now.DayOfYear.ToString & “_” & DateTime.Now.ToString(“ddMMMyy”)
Sequence one concludes with a simply named “archiveFolder” and our initial setup is complete. (Note: existing folders will not overwrite, so “remaking” the archive folder will not error)
Sequence 2: List Files
Sequence two begins with the For Each activity, configured to iterate through all files in the working directory. For each file, the automation performs two initial actions: get filename without the extension, and split filename on the dash (per SOP). (see figure 6). This leaves the root of the filename stored in memory for the following word operations.
The WordApplicationScope activity is part of the UiPath Word Activities installed earlier and has two functions within this automation. First, the scope activity acts as a traditional With statement, ensuring action on the desired object (MS Word doc). Second, the UiPath word activities harbor a useful activity not found in generic UiPath – Export to PDF. This will publish each word doc as a PDF by briefly opening the file and save the PDF in our dated folder. The final action in sequence two is a file move of all word docs into the archive folder. Each word doc is published to PDF and then moved into an archive, ending the sequence.
Sequence 3: Disseminate Reports
The final sequence is email integration, which will send each newly created PDF to a recipient. First, as seen in figure 8, Formatting.txt is our next configuration file. This file is the template for the email body, and this concept is easily adapted to most needs. The text file contains the following:
Dear Human,
Attached are the final reports as of {0}.
Have a great {1} !!
Sincerely,
{2}
And your robot overlords at Cylon Command
This is called via the command: String.Format(template, DateTime.Now, System.DateTime.Now.DayOfWeek.ToString, "Mike")
which fills in each {#} in order, resulting in the clean email body we see in figure 9.
This document publishing/file managing/email sending workflow is a basic UiPath automation created in just a couple of hours with simplicity in mind. Simple automations like this provide quick wins when attempting to build organizational momentum for RPA. Potential benefits are:
small, easily adaptable and maintainable workflow
ensure standard folder/file naming
customizable template resulting in efficient, automatic emails
In conclusion, I hope all readers found value from this UiPath example of upgrading a small work process into supervised automation process.