Question

Using a Variable in a Global Value

  • 21 March 2023
  • 4 replies
  • 261 views

Badge +5

My original set up was with one user per VM. However due to restrictions on the number of VMs I can have I am looking into having multiple users per VM. Each of my bots uses a configuration file stored locally on the VM in a folder (C:\RPA Resources), this location is stored in a Global Value and is used by all my bots. If I move to multiple users and the same bot uses a different configuration then I will need to have different config file for each bot. My plan is to have separate folders for each user e.g C:\RPA Resources\User1 & C:\RPA Resources\User2 with differing config files in each User subfolder. To minimise the number of changes to bots (I have about 40 in use) I was hoping to insert the extra folder reference right at the top in the Global Value.  

e.g. C:\RPA Resources\$System:AATaskExecutor{"Executor_UserName"}$

However this returns the string exactly as above and doesn't insert the value of the TaskExecuter.

Am I doing this wrong, is this possible?

Alternatively can I update the value of the global variable during runtime?


4 replies

Badge +1

It’s been 3 months since you asked your question. Hopefully, you’ve found an answer by now. But for anyone who might want to know, unfortunately, it appears, at least for now, that Automation Anywhere doesn’t allow Global Values to interpret user variables, unless there is an API to update a Global Value that I’m unaware of.

Userlevel 3
Badge +6

Global values should be renamed to Global variables in CR UI as it’s misleading, it’s a variable which can hold different values and bot editing interface shows them as variables.

Global values have an option to set the scope: “can be changed”.

This allows same global variable to have different value at runtime depending upon the user executing the bot. Users executing the bot must set their values for this variable through CR > Manage > Global value> <<Global value»

 

Global values are just public version of user provided credentials.

Badge +1

@Sumit.K7 No argument there on how this feature should be named. I’ve had the same contention since this feature was originally introduced in A2019.

However, I if I’m not mistaken, I think question here is whether it is possible to make value of the global variable unique to a specific user in a multi-bot operation. The short answer is yes, as you’ve stated and explained. Thank you for that! However, if @Rob Sytner‘s goal here is to insert a user variable into the Global Value (Variable) string field to return the interpreted value, it does not yet appear that this is possible at the moment.

Userlevel 3
Badge +6

@ThomasG It’s not directly possible but could be achieved what @Rob Sytner is trying to  through evaluate variable action, however this needs to have an extra step for package variables.

 Eg.

Create a Global value called “USER_PATH” with value as “C:\RPA Resources\$Current_User_Name$”

Create a task with following actions:

  1. String Assign action: $System:AATaskExecutor{"Executor_UserName"}$ to task variable called ‘Current_User_Name’  - this name should match with the global value string as evaluate works only with task variables and not package variables.
  2. String Evaluate variable action: $@USER_PATH$ and assign to desired variable $Current_User_Path$

 

For updating global values during runtime, you can use PUT request to update. Note: Global values are fetched at the beginning of bot run any changes to global values will only reflect in upcoming deployments.

PUT: CR_URL/v1/globalvalues/values

Example for changeable scope request body:

{"key":"your_global_value_name","name":"your_global_value_name","description":"","type":"STRING","isOverridable":false,"isPublic":false,"value":{"type":"STRING","string":"value of global value"},"userId":"123"}

 

Reply