UiPath Custom Activity

Custom Activity

                  UiPath provides all the necessary activities to perform the required operations for automating any task. But there are scenarios where you want to add your custom code or want to use the existing .dll files. To perform these operations UiPath provides flexibility to add custom activity where you may add the required code that suits your requirement.

Please follow the below steps to create a custom activity for UiPath,

Create a .dll file

o   Open visual studio>Create new project>Workflow>Activity Library
o   Once project is created you can drag and drop existing activities to design custom activities. You can also write a code directly by adding a class file in Solution Explorer which will recognize as an activity.
o   In the solution explorer delete the Activity1.xaml and add new class file to it
o   In the newly added class file add the required code, for this demo let’s consider adding 2 numbers. Add the following code. Also please take care of points specified below –
§  Add a reference to System.Activities in the code.
§  Class should be sealed and must extend CodeActivity in order to recognize this code as an activity.
§  The return type must be specified with CodeActivity and the return type of Execute method must be same. For example, here return type is int which is same in CodeActivity and Execute method.
§  InArgument is used so that you can pass the value to the activity in properties window.
o   Build this project which will create the .dll file in the debug folder.

   Creating a NuGet Package

  • Open Nuget package explorer
  • Select create a new package
  • Right click on Package Content area -> Add Lib Folder
  • Right click on Lib Folder - > Add Existing File
  • Select the .dll file in bin folder under MyCustomActivity project folder.
  • Once the DLL’s are added, click on Edit -> Edit Metadata
  • IMP: It is necessary that package name must have Activities term in its name. Else it will not be recognized by UiPath. Here we have added .Activities
  • Save the changes. Now go to File -> Save As, You will see the package Name, Extention (.nupkg) of the package and Path.

Integrating Package with UiPath


  •          Copy NuGet package and paste it into the C:\Program Files\UiPath Studio\Packages.
  •          Open UiPath, click on the Manage Packages.
  •          Click on Available -> Local -> MyCustomActivity.Activity -> Install
  •          The Activity will be available in Activities Tab. Now it’s ready to use In UiPath.


9 comments:

  1. Hello There,
    Just the information I was looking for. Thanks for the detailed instructions. I haven’t used it yet but I guess the time has come.
    We have followed the steps in the link https://www.uipath.com/kb-articles/uipath-robot-api6
    while executing the invoke command in PowerShell “Invoke-RestMethod http://127.0.0.1:8080/UiPath/service/agent/IsAlive -Method Get” we are getting an XML(We have attached it , saved it as a config file and opened in IE .Upon opening the config file,the page provided in the below image is being displayed ) instead of True or False.
    Please provide any help on this or advise us how to proceed

    IsAlive Output in PowerShell.png779x703 14.3 KB

    Anyways great write up, your efforts are much <a href=" https://medium.com/@infamdm02/blue-prism-training-tutorial-certification-and-interview-q-a-9d1602dc22a1”> suchappreciated </a>.
    Regards,
    Ganesh

    ReplyDelete
  2. Hi There,

    Awesome article. Thanks for making that available. I've been using your help to build my own POC and will publish the steps in another blog soon.
    UiPath: Visual Design - Faster Implementation
    Build Modular Automation and Reuse at the workflow level. Extend UiPath functionality via custom activities or various integration can be used for various integration.
    Can be used for various integration services with different workflow modules hence scoring high on re usability.
    Anyways great write up, your efforts are much appreciated.

    Cheers,
    Lee

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Great presentation of RPA form of blog and RPA tutorial. Very helpful for beginners like us to understand RPA course. if you're interested to have an insight on RPA training do watch this amazing tutorial.:https://www.youtube.com/watch?v=x0oC6NKEPgQ

    ReplyDelete
  5. I think things like this are really interesting. I absolutely love to find unique places like this. It really looks super creepy though!! rpa training in velachery

    ReplyDelete
  6. Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. Employee Feedback

    ReplyDelete
  7. Thanks, this is generally helpful.
    Still, I followed step-by-step your method in this
    ui path training
    ui path online training
    ui path course
    rpa online training

    ReplyDelete
  8. Writing is a most challenging career for most. Here are reasons why people who actually can write very well would rather choose not to make a living out of it. https://www.zhitomir.info/news_198441.html

    ReplyDelete

Robotic Process Automation

Robotic Process Automation - RPA                       Robotic process automation is the trending technology where soft...