How to Reuse Code?

In Java and Oracle, we have functions that can be called/reused. For example, we have a function called ‘custom_debug’, that will write to the database table in addition to the log file. How do I do the same in UIPath?
For example, I want to create a sequence that will (1) make a db call, (2) write to log. I want this to be used by all the Developers when they do their Development.

Welcome to the UiPath community @chakingal

you can create the template of that workflow and share it across your team
You can create a library out of it and publish to orchestrator, so that everyone connected to orchestrator can use it To create a library you can open the UiPath studio and select Library to start with and then publishing that will generate a library component on orchestrator

Code Snippets or custom activities inside a library. However, with either of these if you change the code you still have to update all the automations that use that code.

Hi @chakingal,

You can follow various routes on this:

  1. As suggested by Rahul and Paul, you can create library for this sequence and have it available to all developers.

But if you also want to give the developers to be able to reuse this as well let them do customizations per their project/module requirements, then you can do below:

  1. Create .xaml file with all these steps which would take inputs as required, so any developer can use this. You would require to have this xaml either available in GIT or SVN etc repositories supported by uipath so collaboration among developers is effective. Alternatively, if you don’t want to use repository(though it is a recommended way to share code among developers) you can consider having this xaml solution available in a storage bucket on orchestrator on your dev environment.

You can achieve this by library too but point to note is that anytime code change is required in library by an developer, he/she would need to have the original unpackaged library code to be able to make edits as you can’t access code of a library like packages when simply downloaded from orchestrator. So again here, making use of repository would be a requirement.


Thank you all for the input.
So, is there a method where if the logic change is made to the original code, it propagates to all the places it was used?
For example, when I write a pl/sql function that is called by other modules, any change to my pl/sql function will automatically be available to others.

Hi @chakingal,

If you use library and make changes to the original code, to propagate change to all developers, all of them would require to upgrade the library version in their projects to be able to make use of new changes.

If you use repository, then as soon as changes are pushed to the code, that also would be required to be updated by all developers on their local machine like usual way stuff is uploaded/downloaded from any repository.

But in no case, it will automatically be changed in developers machine without them doing anything to upgrade their code.

This is handled the same way like it’s done in any coding language and multiple developers working on same projects.



1 Like

Hi @chakingal,

If your query is resolved, I would suggest marking solution so this topic can be closed.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.