Is it able to 'Lock' an asset?

Hello UiPath Masters,

I wonder if there is a way to ‘lock’ an asset when it’s in use in UiPath (so any other running processes cannot acquire it)? Or any other tools that can help to dynamically assign assets?

Background:
Recently I’m automating a process on an application, which allows only one session for a username (i.e. if I used ‘username1’ logged on the application on server A, and after a while my teammate also used ‘username1’ logged on the application on server B, then my session will be logged out with a message “You have been logged on elsewhere”). I have 2 sets of credentials for this application, while any 2 of my 5 robots may run this process concurrently to shorten turnaround time.
The script structure is like “Get a transaction item → Get an available credential → Process on the application → Shutdown application and clean up → Get another transaction item → …(looping until no new items in queue)”, and I’m kind of stuck at the step “Get an available credential” as I’ve no idea which username is in use when there is another process already running.

Sorry for my bad English…Thank you in advance for your patience to read through this!

you can create different username for different server and then while creating assets create with value per bot.

Thanks Reshmamore; I’ve considered this however I have only 2 application credentials against 5 robots…I cannot let the process running on fixed robots (as the fixed robots may not available when I want to start the process, causing turnaround time impacted), which means if I create the ‘Per Robot’ assets there are still chances that the robots got the same credential…

Okay. That means at any point of time you can use 2 robots as you have only 2 application login details.

You can do small code changes to handle “You have been logged on elsewhere” .
Create a asset credentials User1 and User2.
When robo pick up item from queue it tries to do login with User1 asset details if above message pop ups it closes the application and open it again and tries with User2 login.

if it fails for both logins then you can add custom failure message and update retry status for same item.

It should help. let me know if any issues

1 Like

Interesting scenario! I understand the pain :frowning:
@Reshmamore’s approach seems a good one.

Only other approach that I can think of where the bots don’t interfere with each other is using the Queues. You may create a mini token system like this :

Create a Credential Manager Queue with with two transactions (one time config)
Add one transaction field : CredentialName and store the asset name of the credentials

Design your Get an available credential workflow like this :

  • Get Transaction Item to get the available credential from the Credential Manager Queue
  • Get Credential to get the application credentials using the CredentialName field from the above transaction item.
  • Return the username and password as arguments

As a part of the Shutdown application and clean up (and your Fail back scenarios in case of errors), add a Add Transaction activity to restore the credential back to the queue as a new transaction (for any other bot to consume)

This way the bots never interfere with the credentials and first two bots out of the five will always have a credential to use.

4 Likes

Yes @kaderms I tried this approach and it worked like a charm. Thanks so much for your help :grinning:
Also thanks @Reshmamore for your hints!

1 Like

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