Hi Harshil,
As per the scope of Session variables, you value will always retain the value till the currently running session is not stopped, terminated or completed. Once the sessions ends and if next time you again try to run a new session for that given process, it is bound to start with a fresh set of values, and you won't be able to retain the values back.
Also, you won't be able to use Environment Variables directly as they are '
read-only' in nature which means once you set them, you can only update the values manually from System tab in your Blue Prism interactive client. Though there is a CMD command line script as well which can help you to actually delete and rewrite values which I have explained in my last approach.
Now, here are few approaches I could think of if you wish to store a value which you can retain in a new session if you want to go with those:
- You could save the value, and have it persisted into some dedicated work queue and have it retrieved the next time when the process runs and first you validate if any item exists or not in Pending state. If yes, then read it from the queue.
- Much easier and simpler way is to use the same persist logic but use a file such as a text file, JSON, XML, spreadsheet or even a database if you have access to it and use that to store and retain your values instead in all of your sessions.
- Another crude approach would be to play with the Blue Prism database directly either from Blue Prism using the SQL Server VBO or create a code in some programming language such as C#. This would access the Blue Prism database table: 'BPAEnvironmentVar' which is responsible for handling environment variables.
However, this approach should be taken cautiously as it would directly deal with your production database so there is an added risk and also you would need to check with either your DBA or IT team if your organization has strict protocols around it. Also, this can potentially impact the support agreement with Blue Prism team in case of any unwanted updates or deletion that can happen on the database through an external script which can cause production database server to be affected drastically. So better check with them before trying this.
- Last approach would be to use the CMD commands where you have two commands called as:
/deleteev <environment variable name>
and /setev <environment variable name> <environment variable type> <environment variable value> <environment variable description>
The idea would be to first read the environment variable value in your process, then use the same, once you want to update the value delete the original environment variable using the first command and then again recreate the same using the second command with updated value in the prior step by executing them in command line either by UI automation approach or by using a code stage to invoke CMD commands via programming.
However, on DX Exchange there is a utility now which can help you to achieve the same: Function for Utility - Blue Prism VBO (AutomateC Wrapper) - 1.0.0
As you can see below in the user guide it has the two actions that we need:
However, the only drawback to this approach is that from what I have seen there might be a time lag between the deletion and the creation process so you might have to test it when you run consecutive sessions and see how it works at your end.
----------------------------------------------------------------Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in futureRegards,Devneet MohantyIntelligent Process Automation Consultant | Sr. Consultant - Automation Developer,WonderBotz India Pvt. Ltd.Blue Prism Community MVP | Blue Prism 7x Certified ProfessionalWebsite: https://devneet.github.io/Email: devneetmohanty07@gmail.com----------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.