studio
latest
false
UiPath logo, featuring letters U and I in white

Studio User Guide

Last updated Dec 17, 2024

Workflow Design

Layout Diagrams

UiPath offers four diagrams for integrating activities into a working structure when developing a workflow file:

  • Flowchart
  • Sequence
  • State Machine
  • Global Exception Handler

Sequence

Sequences have a simple linear representation that flows from top to bottom and are best suited for simple scenarios when activities follow each other. For example, they are useful in UI automation, when navigation and typing happens one click/keystroke at a time. Because sequences are easy to assemble and understand they are the preferred layout for most workflows.

Flowchart

Flowcharts offer more flexibility for connecting activities and tend to lay out a workflow in a plain two-dimensional manner. Because of its free form and visual appeal, flowcharts are best suited for showcasing decision points within a process. Arrows that can point anywhere closely resemble the unstructured GoTo programming statement and therefore make large workflows prone to chaotic interweaving of activities.

State Machine

State Machine is a rather complex structure that can be seen as a flowchart with conditional arrows, called transitions. It enables a more compact representation of logic and we found it suitable for a standard high-level process diagram of transactional business process templates.

Global Exception Handler

The Exception Handler is designed to be used in both small and large automation projects, for identifying execution errors and most importantly, determining the workflow behavior when such an error occurs. If an execution error is encountered during debugging, the Global Exception Handler may be set to step in and allow you to check the workflow's behavior in accordance to the options previously set in the Exception Handler.

Choices

Decisions need to be implemented in a workflow to enable the Robot to react differently in various conditions in data processing and application interaction. Picking the most appropriate representation of a condition and its subsequent branches has a big impact on the visual structure and readability of a workflow.

If Activity

The If activity splits a sequence vertically and is perfect for short balanced linear branches. Challenges come when more conditions need to be chained in an If… Else If manner, especially when branches exceed available screen size in either width or height. As a general guideline, nested If statements are to be avoided to keep the workflow simple/linear.



Flow Decision

Flowchart layouts are good for showcasing important business logic and related conditions like nested If statements or If… Else If constructs. There are situations where a Flowchart may look good even inside a Sequence.



If Operator

The VB If operator is very useful for minor local conditions or data computing, and it can sometimes reduce a whole block to a single activity.



Switch Activity

The Switch activity may be sometimes used in convergence with the If operator to streamline and compact an If… Else If cascade with distinct conditions and activities per branch.



Flow Switch

The Flow Switch activity selects the next node depending on the value of an expression; Flow Switch can be seen as the equivalent of the procedural Switch activity in flowcharts. It can match more than 12 cases by starting more connections from the same switch node.



Data

Data comes in two flavors when it comes to visibility and life cycle: arguments and variables. While the purpose of arguments is to pass data from one workflow to another, variables are bound to a container inside a single workflow file and can only be used locally.

Variable Scope

Unlike arguments, which are available everywhere in a workflow file, variables are only visible inside the container where they are defined, called scope.

Variables should be kept in the innermost scope to reduce the clutter in the Variables panel and to show only, in autocomplete, what is relevant at a particular point in the workflow.

Note: If two variables with the same name exist, although we highly recommend against it, the one defined in the most inner scope has priority.

Arguments

Keep in mind that when invoking workflows with the Isolated option (which starts running the workflow in a separate system process, only serializable types can be used as arguments to pass data from a process to another. For example, SecureString, Browser and Terminal Connection objects cannot safely cross the inter-process border.

Default Values

Variables and input arguments have the option to be initialized with some default static values. This comes in very handy when testing workflows individually, without requiring real input data from calling workflows or other external sources.



Naming Conventions

Meaningful names should be assigned to workflow files, activities, arguments, and variables in order to accurately describe their usage throughout the project.

Projects should have meaningful descriptions, as they are also displayed in the Orchestrator user interface and might help in multi-user environments.

To improve readability, variable and argument names should also align to a naming convention:

  • Snake case: First1_Name2, first_name2,
  • Upper or lower Camel case: FirstName, lastName,
  • Pascal case: First1Name2, First1Name,
  • Kebab case: First-Name, First-Name1.
Argument names should have a prefix stating the argument type, such as in_DefaultTimeout, in_FileName, out_TextResult, io_RetryNumber.

Activity names should concisely reflect the action taken, such as Click the Save Button. Keep the part of the title that describes the action (Click, Type Into, Element Exists, etc.).

Except for Main, all workflow names should contain the verb describing what the workflow does, such as GetTransactionData, ProcessTransaction, TakeScreenshot.

Comments and Annotation

The Comment activity and Annotations should be used to describe in more detail a technique or the particularities of a certain interaction or application behavior. Keep in mind that other people may, at some point, come across a robotic project and you can try to ease their understanding of the process.



Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.