# Quickstart guide

> Create your first coded automation in Studio with a quickstart tutorial that generates random numbers and performs arithmetic operations.

This quickstart guide helps you embark on the journey of working with coded automations. You will learn how to create coded automations following a tutorial that shows how to create a coded workflow that generates random numbers between 1-100, and performs addition or subtract operations based on whether the numbers are even or odd.

## What are coded automations?

Coded automations are automations created using code, instead of drag-and-drop activities. When developing coded automations, you can use UiPath services (equal to activity packages), coded automation APIs (similar to activities), external .NET NuGet packages, and your custom C# classes in UiPath Studio. This makes it easy to integrate with external systems, databases, APIs, and other services. Coded automations can be of three types:

1. **Coded workflows** - used for designing workflows in code.
2. **Coded test cases** - used for designing test cases.
3. **Code source files** - used for creating code that you can later call in other coded file types.

Visit the [Introduction for coded automations](https://docs.uipath.com/studio/standalone/2026.10/user-guide/coded-automations-introduction#introduction) to learn more.

## Scenario

In this tutorial we use the [RandomNumber](https://docs.uipath.com/activities/other/latest/workflow/uipath-testing-api-itestingservice-randomnumber) coded automation API to generate random decimal numbers within the specified range. We then check if the generated numbers are even, using a custom method named `IsEven`, and perform addition or subtraction based on that condition.

## Create the coded workflow

Create the coded workflow within your Studio project, and install the necessary dependencies.

1. Install **Testing.Activities** 23.10, because the scenario involves using the [RandomNumber](https://docs.uipath.com/activities/other/latest/workflow/uipath-testing-api-itestingservice-randomnumber) coded automation API from the [Testing service](https://docs.uipath.com/activities/other/latest/workflow/testing-apis).
2. Create a coded workflow by selecting **New**, and then **Coded Workflow** from the **File** group.

Coded automations are structured with namespaces, helper classes, and entry point methods. The base class, `CodedWorkflow`, is used for both coded workflows and test cases, and it provides access to necessary interfaces and services. The entry point method, named `Execute()`, is crucial for running these automations and can be customized with input and output arguments.

   ![Create the coded workflow](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-321394-6c1d0838.webp)

## Design the coded workflow

Write the code in the Studio IDE that consists of a dedicated code editor, file tabs, and breadcrumbs for easy navigation.

1. In the coded workflow, but outside of the `Execute()` method, create a custom method named `IsEven`.

This method returns a `boolean` value, that represents if the `decimal` variable inputted is an even number or not.

Check out the code example below:

   ```
    private bool IsEven(decimal number)
           {
              // Check if a decimal number is even
           return (number % 2 == 0);
           }
   ```
   :::tip
   If you don't want to create a custom method in a separate **code source file**, then you can create it within the coded workflow or coded test case, but outside the `Execute()` method.
   :::
2. Inside the **Execute** method use the [RandomNumber](https://docs.uipath.com/activities/other/latest/workflow/uipath-testing-api-itestingservice-randomnumber) coded automation API to create two `decimal` variables with a random value, and print them out in the console using `Console.WriteLine`.

Check out the code example below:

   ```
   // Generate random numbers within a specified range (e.g., 1 to 100)
           decimal num1 = testing.RandomNumber(1, 100);
           decimal num2 = testing.RandomNumber(1, 100);
               
           Console.WriteLine($"Generated numbers: {num1} and {num2}");
   ```
   :::note
   Write coded automations using UiPath services, custom C# classes, and .NET libraries from `nuget.org`. In coded automations, services function like activity packages in low-code automations. Key services include [System.Activities](https://docs.uipath.com/activities/other/latest/workflow/system-apis), [UiAutomation.Activities](https://docs.uipath.com/activities/other/latest/ui-automation/ui-automation-apis), and [Testing.Activities](https://docs.uipath.com/activities/other/latest/workflow/testing-apis).
   :::
3. Create an **If** statement that adds the numbers if both are even, or subtracts them if at least one is odd.
   Print both results to the console using `Console.WriteLine`.

Check out the code example below:

   ```
    if (IsEven(num1) && IsEven(num2))
           {
               // Both numbers are even, so add them together
               decimal sum = num1 + num2;
               Console.WriteLine($"Both numbers are even. Sum: {sum}");
           }
           else
           {
               // At least one number is odd, so subtract them
               decimal difference = num1 - num2;
               Console.WriteLine($"At least one number is odd. Difference: {difference}");
           }
   ```

![Design the coded workflow](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-321224-d51a0251.webp)

## Manage the coded workflow process

After you create and design a coded workflow, you can validate it, using the **Workflow Analyzer**, debug it, run it, and then publish it to Orchestrator.

1. In the **Design** ribbon, select **Analyze File** and then **Validate File** to check the coded workflow file for C# compiler errors.

   ![Manage the coded workflow process](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-324361-96766571.webp)

Visit [About Workflow Analyzer](https://docs.uipath.com/studio/standalone/2026.10/user-guide/about-workflow-analyzer) to read about the **Workflow Analyzer**.
2. In the **Debug** ribbon, select **Debug File** to debug the coded workflow file and check for inconsistencies at runtime.

   ![Manage the coded workflow process](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-324369-f2a88d3b.webp)
3. Either in the **Debug** or **Design** ribbon, select **Debug File** then **Run File**, to run the coded workflow file that you created.
4. Select **Publish** in the **Design** ribbon. The **Publish Process** dialog appears.
5. In the **Publish options** tab, select where to publish the project. The available options depend on the type of project you are publishing.

For **Processes**:
   * **Orchestrator Tenant Processes Feed**, **Orchestrator Personal Workspace Feed**
   * **Assistant (Robot Defaults)** - the default package location for the Robot and Assistant, `C:\ProgramData\UiPath\Packages`. Projects published here automatically appear in the Assistant. The option is not available if Studio is connected to Orchestrator. These options are available if Studio is connected to Orchestrator.
   * **Custom** - either a custom NuGet feed URL or local folder. Adding an **API Key** is optional.
6. Select **Publish**. A NUPKG file is created and uploaded to Orchestrator, the custom NuGet feed, or saved in the local directory.

### Sample project

To follow the steps of this tutorial and try it out yourself, you can download the following sample project: [First Coded Workflow](https://dev-assets.cms.uipath.com/assets/examples/CodedAutomations/FirstCodedWorkflowQuickStartGuide.zip).

### Next steps

Visit the resources below to enhance your knowledge on coded automations:

* [Studio IDE](https://docs.uipath.com/studio/standalone/2026.10/user-guide/studio-ide)
* [Working with Input and Output arguments](https://docs.uipath.com/studio/standalone/2026.10/user-guide/working-with-input-and-output-parameters)
* [Best practices](https://docs.uipath.com/studio/standalone/2026.10/user-guide/coded-automations-best-practices#best-practices)
* [Working with Coded automations](https://docs.uipath.com/studio/standalone/2026.10/user-guide/working-with-coded-automations)
* [Tutorials](https://docs.uipath.com/studio/standalone/2026.10/user-guide/coded-automations-tutorials)
