03-28-2023 12:08 PM - last edited on 05-25-2023 05:42 AM by JackLacava
I have some business rules that need to identify which environment the BR is running in. This is because they does different things in each environment. In one BR i want the process to run in Prod but not QA or Dev, in another i want to copy extract files to an external shared folder which is different for each environment. I was thinking of using a dashboard parameter but if after a Prod to Dev/QA refresh i forget to change the value of the parameter, the BR will copy the files to the Prod external folder and i don't want that to happen. this is why i am trying to find a way to identify the environment without relying on the value in a parameter. Any thoughts?
Have a great day!
Bill
Solved! Go to Solution.
03-28-2023 01:54 PM
You could retrieve the connection URL using,
si.WebServerUrlUsedByClient
& differentiate the Environment by identifying specific keywords (Dev/Stage/Prod) in it.
03-28-2023 12:52 PM
Please see if the substitution variable |AppName| helps. This is a general substitution variable cand provides the application name. It can be used in Business rules.
03-28-2023 01:50 PM
Unfortunately we use the same application name for all our environments. We are currently On-Prem. When we refresh from Prod to Dev and QA we do not rename the Dev/QA applications. if we did, that would work great. Any other thoughts?
03-28-2023 01:54 PM
You could retrieve the connection URL using,
si.WebServerUrlUsedByClient
& differentiate the Environment by identifying specific keywords (Dev/Stage/Prod) in it.
03-28-2023 02:02 PM
hiren, Thank you, that is exactly what I needed.
05-15-2024 09:02 AM
si.WebServerUrlUsedByClient gave an empty string when I tried using it in v8.2.1. As an alternative solution, I ended up creating a system level dashboard parameter to store this info in the framework database. Should work for us as we only copy applications between environments.
05-19-2024 07:15 PM
Try this.
Dim harvestFolder As String = BRAPi.Utilities.GetFileShareFolder(si, FileShareFolderTypes.BatchHarvest, Nothing)
Dim serverName = harvestFolder.Split("\")(2)
Just grabbed it out of some code lying around but believe it works.