Welcome to our guide on the various types of workflows in UiPath. Workflows are the backbone of any automation project. Understanding different workflow types is essential for building efficient and modular automation projects. In this blog, we'll explore the various types of workflows UiPath offers and how to leverage them for optimal results.
When working with UiPath, understanding the basic concept of workflows is essential. Workflows in UiPath are a series of interconnected activities that automate specific tasks or processes. The Main Sequence, acting as the primary workflow container, organizes activities in a structured manner, providing a clear flow of execution. Let's explore the types of workflows in UiPath and it's features.
Types of Workflows:
Currently, there's been a nine types of workflows in UiPath Studio. They are
1. Sequences
2. Flowcharts
3. State Machines
4. Forms
5. Workflow from a Template
6. Coded Workflow
7. Coded Test Case
8. Code Source File
9. Global Exception Handler1. Sequences
Sequences serve as the smallest project units in UiPath, suitable for linear processes by facilitating seamless transitions between activities within a single block. They stand out for their reusability, whether as standalone automations or integrated into state machines or flowcharts.
Their key feature lies in the ability to be effortlessly reused in various settings; for instance, creating a sequence to extract data from a database and using it elsewhere with minimal property adjustments. However, when copying numerous activities between sequences, it's advisable to scroll to the Designer panel's bottom due to a Windows Workflow Foundation limitation.
New Sequence Creation: Studio > Open/Create Process > Design > New > Sequence
Example: Create a sequence to ask the user for their age, double it, and display the result:
- Open UiPath Studio and create a new blank process and, on the design tab select New and select Sequence then named as "Age Doubler."
- Drag an Input Dialog activity to prompt the user for their age, storing it in a variable, e.g., UserAge.
- Add an Assign activity to double the age: DoubledAge = UserAge * 2.
- Use a Message Box activity to display the doubled age: "Your doubled age is: " + DoubledAge.ToString
- Run the automation, and it will ask for the user's age, double it, and present the result in a message box.
2. Flowcharts
Flowcharts are useful in various situations, from big projects to small, reusable components. What makes them different from sequences is their ability to handle complex business processes with multiple branches, allowing for versatile connections between activities.
Another handy feature of flowcharts is the Auto Arrange option, which helps organize the workflow elements neatly. This makes it easier to understand and work with complex processes, improving efficiency in automation projects.
New Flowchart Creation: Studio > Open/Create Process > Design > New > Flowchart
Example: Create a sequence to ask the user for their age, double it, and display the result:
- Drag an Input Dialog activity to get a number from the user and store it in the Number variable.
- Add a Flowchart activity. Add a Decision activity in the flowchart "Condition: Number > 0" Add another Decision activity "Condition: Number = 0"
- Add three Message Box activities:
If the first Decision is true, display "Positive Number"
- If the second Decision is true, display "Zero."
- If none of the conditions are met, display "Negative Number"
- Connect the Decision activities and Message Box activities based on the conditions.
- Run the flowchart, and observe the output based on the input you have given.
3. State Machines
In UiPath, a State Machine is a type of workflow that models a process as a set of states, transitions, and activities. It is particularly helpful in scenarios where a process can exist in various states and transitions between these states depend on specific circumstances. Here's an overview of State Machines in UiPath:
1. States: States represent the different phases or conditions in a process. For example, in an order processing system, states could be "Received", "Processing", and "Shipped."
2. Transitions: Transitions define the conditions under which a process moves from one state to another. These conditions are often based on specific criteria being met.
3. Activities: Each state in a State Machine contains a set of activities that need to be executed when the process is in that state. These activities define the actions performed during that phase.
4. Initial State: A State Machine has an initial state, which is the starting point when the workflow is initiated. From the initial state, the process can transition to other states based on defined conditions.
5. Final State: A State Machine also has a final state, which represents the conclusion of the process. Once the process reaches the final state, it indicates that the entire workflow is complete.
New State Machine Creation: Studio>Open/Create Process > Design > New > State Machine
Example: Guess the number
- Init Random Num State: Generates a random number in Entry block RandomNumber = New Random().Next(1, 100).
- Guess Number State: Use Input Dialog Box to store the user input number in the range of 1 to 100 in a variable InitialGuess.
- Final State: Marks the end of the automation, displaying the final congratulatory message when the correct guess condition is met.
- Try Greater Transition: Give InitialGuess<RandomNumber condition and add message box with message "Enter Greater number".
- Try Smaller Transition: Give InitialGuess>RandomNumber condition and add message box with message "Enter Smaller number".
State Machines are particularly beneficial when dealing with processes that have well-defined states and transitions, providing a structured and visual representation of complex workflows. They enhance the clarity of process logic, making it easier to understand and maintain.
4. Forms
In UiPath Studio, a Form, denoted by a .uiform extension, serves as a file containing design and layout information for crafting personalized user interfaces through the Form Builder. This specialized tool, an implementation of the form.io engine, offers a drag-and-drop interface within the Designer panel, allowing the creation of customized forms and callouts for attended automation workflows.
The Form Builder boasts a range of form elements, including text boxes, dropdowns, checkboxes, and radio buttons, providing users with a seamless experience in designing forms. Following creation, these forms can be seamlessly integrated into automation projects using the Show Form or Show Callout activities, offering flexibility in display triggers and enabling bidirectional communication by defining data exchange between the form and the workflow.
New Form Creation: Studio > Open/Create Process > Design > New > Form
Note: You have to install the UiPath.Form.Activities Package to get the form activities.
Once in the Form Builder, use the Properties panel to customize aspects like Title, Width, Height, taskbar visibility, window frame display, theme selection, and application of custom CSS classes. Efficiently manage form components by creating triggers, rearranging elements, and editing JSON schemas. This user-friendly tool streamlines the creation of complex forms for enhanced attended automation workflows.
For detailed customization, explore options such as creating triggers, moving and editing components, and modifying JSON schemas. Explore further details about forms by clicking the link below.
Forms in UiPath
5. Workflow from a Template
UiPath Studio supports the use of workflow template as foundational models for creating other workflows. Options include built-in template like Sequences and Global Exception Handlers, custom templates or those from installed libraries. Conditions and limitations exist, including template specificity to project type and language.
New Workflow from a Template Creation: Studio > Open/Create Process > Design > New > Workflow > Select the template from the dropdown
Template Sources:
- Built-in file templates include Sequence, Flowchart and State Machine templates catering to various workflow designs.
- Local file templates are created within the project's Templates folder, offering customization specific to the project.
- Packages file templates originate from libraries or activity packages, expanding template choices during workflow creation.
Adding and Using Template:
- Local file templates are added using the contextual menu in the Project panel, offering workflow, execution, and test case template options.
- Extraction of existing workflows as templates is possible through the "Extract as Template" option in the Project panel.
- When creating a new workflow, you can select templates from installed libraries under Package file templates in the Template dropdown. Workflow templates can be crafted within libraries, following the same process as creating them for processes. Upon publishing the library, templates marked as "public" become accessible as package file templates. These templates can then be utilized in projects where the library is installed as a dependency.
6. Coded Workflow
Coded workflows in UiPath are similar to low-code workflows but are built using a code-based interface. They seamlessly integrate with low-code activities and workflows, allowing for a hybrid automation approach that combines the benefits of code-based automation with visual design elements. Coded automations feature a structures design with namespaces, helper classes, and entry point methods.
The C# programming language is employed to write the automations, offering flexibility and extensibility. Coded automations are compatible with Windows and Cross-platform projects, offering flexibility in their usage.
New Coded Workflow Creation: Studio > Open/Create Process > Design > New > Coded Workflow
Benefits of Coded Automation: Integration with low-code activities and workflows allows a hybrid automation approach, combining the advantages of code-based automation with visual design elements. The structured design of coded automations in C# offers enhanced customization and control over automation behavior.
Key Components in Coded Automation: Coded automations use the CodedWorkflow partial class from the UiPath.CodedWorkflows package, providing essential interfaces for services and dependencies. The CodedWorkflowBase class, which coded automations inherit, contains built-in functionalities for managing workflow instances, runtime access, logging, and configuration of environment contexts.
CodedWorkflowBase Functionalities: Noteworthy methods within CodedWorkflowBase include accessing the service container, retrieving running job information, logging messages, and executing workflows. Additional functionalities include delaying execution, building HTTP clients, and registering services to the coded workflow's service locator.
Entry Point Method - Execute(): The entry point method for both coded workflows and test cases is named Execute(), attributed as either Workflow or TestCase. This method, serving as the starting point for running the automation, allows for the addition of input and/or output arguments, mirroring their counterparts in low-code automations.
Note: The UiPath.CodedWorkflows package is automatically included when you import an activity package that supports coded automations, such as UiPath.System.Activities 23.10 or higher.
7. Coded Test Case
Coded test cases in UiPath offer a structured approach to automate and validate application behavior, akin to low-code test cases. This mode of automation provides the flexibility of using code for precise control. A coded test case follows a Given-When-Then structure, comprising three phases: Arrange, Act, and Assert. These phases streamline preparation, execution of actions, and verification of expected results.
Coded test cases seamlessly integrate with low-code workflows or test cases, facilitating code reuse. This integration empowers developers to create dynamic test scenarios, combining the strengths of code-based and low-code automation. Execution templates can be applied to enhance coded test case executions, adding further flexibility.
New Coded Test Case Creation: Studio > Open/Create Process > Design > New > Coded Test Case
8. Code Source File
Code source files in UiPath act as repositories for custom classes or methods, contributing to the modularization and reusability of code within the Coded workflows or test cases. While they lack independent execution capabilities, they play a pivotal role within the broader project context.
The inherent structure of Code Source Files is flexible, given their inability to run autonomously. Studio dynamically generates the namespace and file name, seamlessly aligning with the project name. This ensures a standardized and coherent structure across the entire project.
The primary utility of Code Source Files lies in their code snippets, meant to be utilized within Coded Workflows or Test Cases. By invoking, defining, or initializing the specific classes or methods from these source files, developers can effortlessly integrate custom logic into their automation processes. This approach significantly enhances code reusability, promoting a more modular and efficient development paradigm.
New Code Source File Creation: Studio > Open/Create Process > Design > New > Code Source File
Explore further details about Coded Automations by clicking the link below.
9. Global Exception Handler
The Global Exception Handler serves as a specialized workflow designed to manage a project's response to execution errors. It's essential in determining the behavior of the automation when faced with errors and is limited to one instance per automation project. Key aspects of the Global Exception Handler include:
Availability and Limitations:
- Not accessible in library projects; exclusively for processes.
- The project must contain only one Global Exception Handler.
Behavior Control: Sets up to retry the activity thrice and then abort with an error message on encountering an exception. Offers strategic choices for error resolution: Continue, Ignore, Retry, or Abort.
Handling Errors During Debugging:
- Detected exceptions pause execution, highlighting the faulted activity.
- Debugging actions include Continue, Stop, Retry, Ignore, Restart, and Slow Step.
- Retry button excludes the Global Exception Handler for the current activity.
- The Global Exception Handler is activated with the Continue action, adhering to pre-defined result values.
Usage with Try Catch:
- Ensure activities are grouped into a Sequence within the Try container for effective Global Exception Handler execution.
- In nested activities, the handler executes for each call stack activity but not directly encapsulated Try Catch activities.
Example: Handling Notepad Automation Error: Illustrates project behavior when an exception occurs during execution. Workflow involves typing text in Notepad, saving the file, and closing the application. A Global Exception Handler is added to address potential errors during execution.
- - Create a Blank Process and design the automation workflow.
- - Add a Global Exception Handler via the Design tab.
- - Modify the workflow to intentionally induce an exception (e.g., closing Notepad prematurely).
- - Execute the workflow to observe the Global Exception Handler in action, logging activity faults, and managing retries.
New Global Exception Handler Creation: Studio > Open/Create Process > Design > New > Global Exception Handler
Comments
Post a Comment