cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to update an Environmental Variable in Blue Prism?

Background Info

I have a process that searches for data between two environmental variables StartDate and an EndDate (dd/mm/yyyy). The process can either find data (which results in a successful run) or not (which results in a unsuccessful run).

Simulation

Let's say we use StartDate = 02/11/2020 and EndDate = 06/11/2020. Data has been found so we can say that the process ran successfully on 07/11/2020.

When I want to run the process a second time, I want it to start from the last successful run instead of manually updating the environmental variable.

Unsuccessful runs are being catched.

Question Is there a way to store the last successful run into the environmental variable StartDate ?

--------------------------------------------------
Disclaimer: This content was auto-posted from Stackoverflow. The original Stackoverflow question is here Stackoverflow Post, posted by elbo.
Hi  I am a Digital Worker. Please check out my profile to learn more about what I do!
7 REPLIES 7

ewilson
Staff
Staff
You cannot set the value of an Environment variable from within a process/object. Data items tied to environment variables are read-only. With that said, there are some ways around this:

  • You could persist the end date value to a work queue and the next time the process runs read it from the queue instead of the environment variable.
  • Similar to the above you could persist to a file.
  • You could write the value to the BP database table responsible for handling environment variables: BPAEnvironmentVar. You must exercise extreme caution with this though as any errors/mis-writes could impact other processes.
  • You could develop a VBO that automates the BP client to open it and update the environment variable value through the UI itself.

Cheers,

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

@ewilson There's also the  ​​AutomateC CLI command /setev

I'm not sure why that command isn't listed in the help docs though.

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

@Dave Morris you are correct. You can set the value using AutomateC, but you have to make sure you supply the variable name, data type, and description in addition to the value every time you want to set it. It makes sense for creating a new environment variable, but it seems kind of goofy, IMHO, for just setting the value of an existing variable. 🤷‍♂️ 

Cheers,


------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

Makes sense. Also, it occurs to me now that unless it's been fixed, I think /setev doesn't work for DateTimes.

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

Any idea whether the CLI works with DateTime or Date now?



------------------------------
Bhagavath Singh
Platform Engineer
Johnson and Johnson
Asia/Kolkata
------------------------------

Hello @bhagavathsinghjnj,

I've tested on v7.1 with a environment variable of type Date and I was able to successfully set the value using AutomateC. However, what I noticed is the updated value wasn't reflected in the Interactive Client UI until I exited and logged back in. For Date, pay attention to the format I used below. That's the only way I could get it accept it:

18676.png
** EDIT **
DateTime also works in the following format:

C:\Program Files\Blue Prism Limited\Blue Prism Automate>automatec /user admin [PASSWORD] /setev Test1 DateTime "2022-08-24 12:54:31" Test​

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

FrantisekHortai
Level 2

Try to do it directly if it is possible. Login into the database which you use or the BP server uses (Look for VBO and set it up e.g. with Data – SQL Server / or similar C# code etc.). After you get the access to your BP database:

Execute

UPDATE [YOUR_BP_DBname].[dbo].[BPAEnvironmentVar]

SET value='YourNewValue'

WHERE name='NameOfYourEnviromentalVar'



------------------------------
Frantisek Hortai
Senior Consultant
EY - Ernst & Young
Europe/Vienna
------------------------------