The Now Platform® Washington DC release is live. Watch now!
In this first blog post I started with this challenge:
RPA Challenge #1 : Invoice Creation & Follow-up Email - RPABOTS.WORLD (rpabotsworld.com)
The high level instructions are:
Your workflow should contain the following steps.
Sounds simple enough - right? So let's get started.
Examining the website / application
I checked the application and this one is indeed fairly straight forward and well structured. Most elements we need carry an 'ID' attribute and are easy to capture using the Chrome extention. I separated the elements into three different screens:
For this to work nicely I had to modify the page match rule for 'Dashboard' to be 'URL Starts With https:://challenge.rpabotsworld.com/admin'. With that I can use the menu-items from any other screen as well and do not need to recpature them. The login page as well as InvoiceAdd are using straight 'Url Equals' rules.
There is one more element I had to manually change the locator, TotalAmount. Using the capture tool it will grab the DIV element and try to match it using a CSS Selector. Much better though is again using the ID which will find a SPAN element holding the amount value we need.
Examining the Excel Sheet
The excel spreadsheet is very basic and has nothing special to it. So reading from / writing to it is easy enough with the Excel connector. I read the whole data table at once using 'ReadFromSheet' component which returns a data table I can loop through.
Generating the invoices
Generating the invoices has some challenges to solve.
Invoice Number
One of the requirements is to generate an invoice number, the web application we work with does not do that autmatically but relys on data input for it. We could do a simple number and count it, but this would cause some issues finding the invoices per run. For this lets generate a unique number - similar like a sys_id in ServiceNow. A random string as prefix with an appended number for every record processed per run will do.
At start of the bot initialize the two elements needed; a counter and a random string generated by the 'Random' component with the defined length - 4 in this case:
Later within the loop of the records we need to increment the counter and combine it with the generated random string to form a unique invoice number:
Customer Selection
The Add Invoice user interface does allow selecting from a list of customers, the presented list though has the customer names formatted a bit differently than the supplied Excel sheet. To make the selection work the excel input has to be modified to be all uppercase and remove spaces. Once ready the drop down component does not react as expected on a 'Select' event. It needs real key-pressed events to trigger the logic to populate the customer information, hence the 'SendKeys' component is a good option.
Dates
Next requirements are billing date to be today and due date to be 45 days in the future. This can be achieved with the DateTime utilies components:
Tax
It's required to calculate the tax amount based on the price and tax percentage of 18%. A simple expression can solve this:
Downloading the Invoice(s)
The download itself is straight forward, use the search box to find the generated invoice and capture the download link to click.
Creating a ZIP file
Our Robot software currently cannot create a brand new ZIP file, but it can add files and directories to an existing ZIP file. To fulfil this requirement an empty ZIP file is required. For the robot I placed such a file in the 'My Documents' folder of the current user. To prepare all files needed to be in the ZIP container I decided to create a new temporary folder and move/copy all to it.
Creating a temporary directory
I decided to create a new directory at the beginning of the robot. A sub-activity make a cleaner canvas. As a directory name I am using the random string generated - kind of a job name by now.
Moving downloaded invoice files
There are two options for this, I choose the easier path of simply waiting some seconds after starting the download. Alternative would be to setup a directory trigger and react and the new file being generated. Once the file is there it is a simple 'MoveFile' operation. The FormatText components are used to calculate source and destination filenames. Source is using 'My Downloads' as prefix to the invoice filename, Target is using the temporary directory created with the invoice filename.
Zipping the work directory
As mentioned, the robot currently cannot create a ZIP file, so this looks more complex than it should be (and yes, creating ZIP files is on our backlog). This activity will take an empty zipfile as input, copy it to another folder and add the input directory to the zip file.
Verdict
That was pretty much it - sending the mail should be simple enough.
How long did it take to build? I recon I spend about 2 full working days in building. A 3rd day for this documentation.
Feel free to download and check it out. If you do, start in the Main activity and modify the variables section in the beginning to make it match your environment. Have any idea to improve it? Comment below, I am happy to take up suggestions.
Next step for me is to make this more a ServiceNow based challenge by replacing the excel sheet with a data table in ServiceNow....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.