[UiPath] Append Line not working when run using Robot or Orchestrator

My log file isn't being created when I'm running the workflow using the robot, even if the path I supplied is already its full path. But then it's working fine when it's being run using the Studio.

Create the log file first before appending to it (using the Create File activity). Normally, UiPath would automatically create the file if it doesn't exist, and then append some line. But for some reason when it's UiPath Robot doing the activity, the file doesn't get created, so UiPath doesn't bother writing anything.

That's it, let me know if it helps! :)

[UiPath] Helpful DataTable methods and queries for better sorting, filtering, extracting

Here are a couple of handy DataTable.Select queries that I found useful in managing data tables. I have previously discussed about How to filter multiple dynamic values in a datatable column but this time I'm going to collect my most used ones for future reference.
How to select distinct values in a row

OutputDT = DataTable.DefaultView.ToTable(true,"ColumnName")

Returns a datatable with distinct values from a specific column. This is similar to running a Remove Duplicate Rows activity except you can directly specify which column to affect.

How to sort data table using multiple columns

DataTable = (From x In DataTable.AsEnumerable() Order By convert.Tostring(x("ColumnName1")),convert.ToString(x("ColumnName2")) Select x).CopyToDataTable

Returns a data table sorted in ascending order by 2 columns. This is similar to running a Sort Data Table activity except that you can use multiple sorting columns.

How to query your datatable using Select method

OutputDT = DataTable.Select("[Column Name] IN ('Value1','Value2','Value3')")

This will return rows where the specified column contains the indicated values. Similar to filtering a table from Excel.

RelatedHow to filter multiple dynamic values in a datatable column

Just a few so far but will add to these as I go along learning UiPath better! :)

[UiPath] How to create Windows user input form using SyForms form designer (IsClosingForm hotfix)

Here's an entry on how to use the SyForms Form Designer package on UiPath which is incredibly helpful in getting user input using a Windows form.

This answers questions on:
✔ How to accept date input from user and
✔ How to accept multiple inputs from user using just one form

But first, a little info on this package:

SyForms is a custom activity developed by Florent Salendres of Symphony as a hackathon entry for UIPath's Power Up Automation 2018. It won Winners Choice and UiPath Grand Prize of Excellence in RPA and is probably one of the most popular form designers from UiPath Gallery. I personally am very thankful I stumbled upon this activity because it provides better user interaction by the way of Windows forms.

Now, all the official documentation you need is here: https://go.uipath.com/component/syforms-uipath-forms-designer

But for the purpose of documenting a how to guide, here's how to use the package and create a simple form that accepts date and text input.

I'm using UiPath Community Edition version 19.8.0

Step 1: Download and install the package

You have two options, you can either download it from the Gallery

OR you can download the hotfix version from this link which addresses the issue of the form not closing upon clicking the submit button (even if the property IsClosingForm is set to True).

If you chose the hotfix version, here's how to install it:

  1. As mentioned above, download hotfix from this link
  2. Save the .nupkg package file under C:\Users\username\AppData\Local\UiPath\app-19.8.0\Packages (or wherever your Packages folder is)
  3. Update the path with the appropriate username and app version folder, in red.
  4. Go back to UiPath Manage Packages and navigate to Local. Symphony should appear.
  5. Install and Save

Step 2: Create a new process and add the activity Show Form

Found under Symphony >> Extensions >> SyForms >> Show Form

Step 3: Create a new form

  1. Click on New
  2. Enter form name
  3. Click OK
  4. It will create a json file. Select it from the dropdown and click Design
Step 4: Design the form

We'll be creating a simple form that accepts Name and Birthday. The designer is pretty straightforward, just click on the type of control you want from the toolbar and position it on the form window.

Step 5: Expose your input arguments

For all your input fields, make sure to set ExposeAsArgument property to True as seen in the above photo. This automatically creates arguments for your fields so that you can access the value later on.

The next thing to do after exposing your arguments is to create Assign To variables to it. I named the 2 variables as var_name and var_bday and set the variable type to Control (System.Windows.Forms.Control).

For the Submit button, you should also set the IsClosingForm property to True so that the form window will close after you click on Submit.

Step 5: Access your input data

Finally, you can access your input data by using the Text property of the Control variable.


Let's try to output it using a message box.

Here's the output:

For the date, you can play around with the text value to output different date formats using the Convert.ToDateTime() and ToString() System methods.

will output the following:

For more DateTime formats and helpful string manipulation techniques, check out:

That's it! Let me know if it works. :)

[UIPath] How to filter multiple dynamic values in one column using DataTable.Select method

I've been looking for ways to filter multiple values in a datatable but I'm only led to one solution, the Select() method. For those who were sold on UIPath being a drag-and-drop-no-coding-required solution to automation, this could be intimidating. Heck, if I didn't know about SQL I'd be dead beat right now. Yup! The only way (at least for now) to select multiple values from a column in a datatable is by using the DataTable.Select method.

Thankfully, it's not that hard.

Say I have this datatable called rulesDT,

And I want to get all rows where Home Location is either London, Manila, or Tokyo

If only UIPath had a feature like this in its Filter DataTable activity, it would be easy right?

UIPath wishlist: Allow IN operation

But since there's none at the moment, here's what worked for me.

Using DataTable.Select()

var rows = new DataRow[]; //Array of DataRow

var outputDT = new DataTable;

assign rows = rulesDT.Select("[Home Location] IN ('London','Manila','Tokyo')");

//Check if there are results
if(rows.Count > 1){
   outputDT = rows.CopyToDataTable();
} else {
   //Do something

The pseudo code above, when applied as a UIPath workflow, will return a datatable with rows that satisfy the query, in this case 5 rows.

It's similar to running a filter rule on MS Excel.

The reason we need to assign the results to a DataRow[] first instead of directly putting the output into DataTable is to avoid running into this exception in case there are 0 rows found. 

You cannot copy 0 rows to a DataTable, that's why we need to check first if the Select query returned at least one result.

Example for querying multiple columns

I want to get Partners between the ages 30 to 40 years old

rulesDT.Select("[Occupation] = 'Partner' AND [Age] >= 30 AND Age <= 40")
There is no BETWEEN operator so we have to use two comparators.

Querying dynamic values

If you want to select multiple dynamic values from a column, you need to build the parameters first then include it as a variable.

•  Using a list of integer

var rows = new DataRow[]
var dynamicIntArr = {20,30,40}
var join_dynamicIntArr = String.Join(",",dynamicIntArr) //Result: 20,30,40
rows = rulesDT.Select("[Age] IN (" + str_dynamicIntArr + ")")
•  Using a list of string
This requires more manipulation as you have to wrap each value inside single quotes. It would be best to prepare the string with single quotes beforehand for easier handling.

var rows = new DataRow[]
var dynamicStrArr = {"'One'","'Two'","'Three'"}
var join_dynamicStrArr = String.Join(",",dynamicStrArr) //Result: 'One','Two','Three'
rulesDT.Select("[Age] IN (" + join_dynamicStrArr + ")")

Very helpful links


How to make an HTML modal window using Javascript and CSS

This is basically an application of this tutorial from w3schools. I've created a fiddle for it and customized mainly the CSS.

Modals are a neat way to present content in an HTML page without making it look cluttered. You can use it to contain information you don't want to be visible at all times. You increase the usability of your website by not having your user jump to a new page for small information or a form.

This is really more of a note to self haha but hope you find is useful too!

[UIPath] How to include default Outlook signature dynamically in Send Outlook Mail Message activity

How nice would it be if UIPath would enhance its Send Outlook Mail Message activity to allow users to include their default email signature?

Something like this...

UIPath wishlist: looking forward to this feature enhancement!

Photo is edited of course hehe but in the meantime that's it's not possible directly, here's a pretty neat workaround I've discovered.
But first, here's the situation. I have a robotic workflow that sends email messages on Outlook, and it's being run by multiple users, depending on who's available. Naturally, the email will be sent from their personal accounts, so the signature must be theirs as well.

I need a way to automatically fetch their signatures as HTML and attach it to the email body. The challenge for different users is that the signature details are different as well, so you have to generate the appropriate ones every time you run the robot.

One way would be to prepare a text file containing a signature template and have them edit the details every time they run the workflow. You can then read this text file and append it to the email body.

But another, more straightforward way is to fetch their signature files directly from Outlook's directory.

Somewhere in your user account's roaming folder is your outlook email signatures. These are the email signatures you've created using your mailbox. In my case, they're stored here:


The folder structure may differ per setup but if you're working with users within the same network or have the same MS Office setup, chances are the path is the same, except for the username of course. And you can get that using the Environment.username variable.

So now that you have the direct path to your Outlook's default email signature, you know the rest. Read it, store it in a text file, and finally append it to your message body. Don't forget to tick IsBodyHtml! :)

Caveat? Images don't work, so there's that.

Hope this helps somehow!

[UIPath] VBA macro for formatting headers in Excel

Here's a neat piece of code I use whenever I needed to apply a macro that formats headers on an Excel workbook. I always come across this step whenever I write a datatable to an Excel file. Datatables are being copied as plain text so you have to format it to make it look more presentable. The goal is to programmatically turn this unformatted workbook...

to a formatted one which is very much readable and ready for reporting:

Here you go:

Private Sub FormatHeaders()
    Dim ws as Worksheet
    For Each ws in Worksheets
        Rows("1:1").Font.Bold = True
        Range(Range("A1"),Range("A1").End(xlToRight)).Interior.Color = RGB(173, 216, 230)
End Sub

What this macro does is loop through all the sheets in the workbook and do the following:
  • Autofit all columns
  • Autofit all rows
  • Bold the headers
  • Add background color to the headers
Then it will focus back on the first sheet.

Now it's easy to read and ready to sent out. Remember to setup MS Excel's trust settings if you're going to run an external macro.

Hope this helps!