marketplace
latest
false
UiPath logo, featuring letters U and I in white
Marketplace User Guide
Last updated Sep 5, 2024

The Simple Activity



Intro

Now that you have your package created, let's add an activity to it! In this example, you will create the activity shown above: a simple one that adds two numbers together.

Steps

1) Open the Activity Creator

Start by opening the Visual Studio solution created in the previous section and select any of the main projects (these are the ones labeled MyCompany.MyProduct...) in the Solution Explorer. Then navigate to Extensions > UiPath > Add Activities in the toolbar.



2) Build an Activity

This will open a new Activity Creator window. The first screen gives you two options:

  1. Create: Build one or more activities from scratch.
  2. Import: Import a list of predefined activities that have been saved in a standard format.

For now, select Create.



3) Define the Activity

Click the Add button and fill in each field as shown below. This will prepare the creator to build an activity named Addition. When ready, click the Edit button to add properties to the Addition activity.



4) Add Properties

This will open a new Define Properties window. Use the Add button to create 3 properties as shown below.

Ensure that the first two are inputs and the last is an output. These properties will represent two numbers and their sum.



5) Generate the Activity

Click OK on the Properties window and Finish on the activities window. You will then see some new files added to your projects.



6) Add Functionality

Open the Addition.cs file that was just created and expand the Protected Methods region within it to reveal the activity's ExecuteAsync method. This is the method that gets called whenever the activity is run in UiPath Studio.

Notice that the two inputs created in step 4 (First Number and Second Number) as well as the one output (Sum) have already been added to this method. The final step is to bridge the gap between them by replacing the comment block with code that adds the two inputs and then sets the result to Sum. See below:



7) Build the Package

Within the Solution Explorer, right-click your solution and select Rebuild Solution. You now have a working activity package!



8) Add the Activities to Studio

In order to use your activities, UiPath Studio has to know where to find them. In the build Output, take note of the location of your newly created activity package. This will come at the bottom after Successfully created package:.


Open UiPath Studio and navigate to the Package Manager's Settings. From here, tell Studio to look for new packages in the output folder copied from above. Once you click Add, you'll be able to see your new activity and import it into future workflows.



Using Your Activities

Once Studio has hooked into your output folder, add your activity set to workflow.



Notice that a new category has been added to the Activities pane.



That's all! Give your new activity a try!



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.