about 4 years ago
Bonus Tech Tip: Creating a Custom Activity
There are just four weeks left in UiPath’s Power Up Automation Hackathon! Avoid feeling rushed by getting your submission ready early. Submissions are due July 22 before 5pm ET. (Find out what time that is in your city.)
Creating a Custom Activity
An activity is the building block of a process automation. UiPath Studio comes with various built-in Core Activities, as well as dedicated activities (PDF, mail, Excel) you can install through the Package Manager. You can read The UiPath Activities Guide for more details and examples, as well as how to Manage Activities Packages.
Depending on your needs as you work to create your component and hackathon submission, you may find the built-in activities won’t do the trick. In this case, you can create custom activities to better automate processes.
There are two major steps required to create a custom activity:
- Writing the custom activity code.
- Adding the external assembly (.dll) in UiPath.
Note that the following components are required to create a custom activity:
- Microsoft Visual Studio with the .NET desktop development workload installed.
- NuGet Package Explorer.
You can write the code for your custom activity either deriving from CodeActivity or NativeActivity. The two activities look rather similar, but there are differences. You can view an example of a detailed NativeActivity here.
CodeActivity provides an Execute method that can be overridden to have your implementation. It also provides access to tracking, variables, and arguments. You can use the CodeActivity for the following:
- Simple custom activities.
- Synchronous activities.
- Execution in a single pulse of execution.
NativeActivity provides all the features of the CodeActivity, but also lets you abort the execution of the activity, cancel child activity execution, schedule activities, use bookmarks, as well as activity actions and functions. You can use the NativeActivity for the following:
- Complex custom activities.
- Running long custom activities.
- Execution in multiple pulses of execution.
- Schedule other activities.
- Use advanced WF Runtime features.
The full UIPath Activity Guide will take you through code example for creating a custom activity.
Good luck and happy building! We can’t wait to see what you come up with.
Questions?
If you have any questions about the hackathon, please post on the discussion forum.