Rahul Prabhu
Rahul Prabhu

Rahul Prabhu

Understanding Layout Diagrams in UiPath

Understanding Layout Diagrams in UiPath

Subscribe to my newsletter and never miss my upcoming articles

Layout diagrams play a crucial role when designing automation workflows, but are we utilizing the activities rightly?

Read to find out šŸ‘‡šŸ½

What's in this article?

  • An overview of layout diagrams
  • Examples of how to use layout diagrams
  • Best practices

Layout Diagrams: An Overview

Although we are free to use any layout diagram in our workflow, choosing and using the right one helps us build a reliable, maintainable, and efficient workflow.

To begin with, UiPath provides us with three layout diagrams: Sequence, Flowchart, and State Machines.

āž”ļø Sequences

Sequences are simple, and one of the most popularly used layout diagrams in UiPath. Sequences are well fitted for linear processes, where the execution flow always starts at the top and ends at the bottom.

Sequences are also easy to use and are auto-created under a lot of scenarios. It can also be used alongside (inside) other layout diagrams.

āž”ļø Flowcharts

Flowcharts are a graphical representation of a business process. Flowcharts are flexible because of its visual appeal, and it allows us to create complex workflows involving decisions without nesting of activities.

The execution flow of a flowchart entirely depends upon its decision nodes where a given condition returns a boolean output. The node evaluates this boolean output and picks a branch to execute the process further. This branching feature is what provides a flowchart, its flexibility.

āž”ļø State Machines

State Machines are complex layouts with a finite number of states. A state is entered and exited when it is triggered by an activity.

Similar to that of a flowchart, the execution flow of a state machine depends on its decision nodes called transitions, where a condition is evaluated to enter its next state.

Every state machine needs to have at least one init state where the process starts and is allowed to have multiple final states, where the process terminates.

These complex layouts are incredibly useful when we need to handle large volumes of data.

Layout Diagrams: Examples

Sequences are well fitted for linear processes. Here's a business scenario:

Fetch emails (from Gmail) with the subject Daily Status Report - Today's Date, download, and save its attachments to a local folder.

From the scenario described above, we can understand that these steps need to be executed in a linear fashion to download and save the attachments therefore, we're going for a sequence.

Here's how a sequence for the above business scenario would look like:

image.png

Flowcharts are well fitted for scenarios involving multiple decisions. Here's a business scenario:

Fetch emails (from Gmail) with the subject Daily Status Report - Today's Date. If no emails are available, look for emails with the subject Daily Status Report - Yesterday's Date and again, if no emails are available, send an email describing the scenario.

Since the given scenario involves decisions, we're going for a flowchart.

Here's how a flowchart for the above business scenario would look like:

image.png

State Machines are complex layouts mostly used for processing large volumes of data. Here's a business scenario:

Fetch emails with the subject Daily Status Report - Today's Date and download its attachments. Upon downloading, read the Excel file, open notepad, and enter all the customer info and save it as a text file.

From the scenario, we can comprehend that a series of steps need to be performed for each row available in the Excel file so, it is best to use state machines and process each row as a transaction.

Here's how a state machine for the above business scenario would look like:

image.png

You can download the source code for the above-mentioned examples from my GitHub šŸ”—

Layout Diagrams: Best Practices

It is always recommended to follow UiPath's best practices for building a reliable, and extendable workflow that can run in production without any errors so, here are some best practices related to layout diagrams.

  • Always rename your layout diagrams and don't hesitate to provide descriptive names like Get Emails from Inbox.
  • Remove unused nodes and empty if-else blocks from the workflow.
  • Do not hesitate to use both the entry and exit sections of a state.
  • Do not hesitate to rename the decision nodes, and the boolean condition it returns (in decision node's properties).
  • Make use of the log messages activity after entering and before exiting each layout diagram, this can help during debugging and production.
  • Make use of the add annotations feature and be creative with it.

Following these best practices will ensure your code has more readability and clarity to it.

Note: Global Exception Handler, another layout commonly used for handling exceptions, is not in the scope of this article. New articles will be posted on the same, shortly.


If you enjoyed reading the article, please give it a like and share it with other automation enthusiasts. Feel free to get in touch via Twitter @monsieurrahul for any queries.

Ā 
Share this