Cloud Pak for Business Automation

 View Only

Using environment variables in IBM Business Automation Application

By Kam To Frederick Ngo posted Wed December 02, 2020 11:12 AM

  
Imagine you are creating an expense reimbursement App (IBM Business Automation Application) for your company. There is a limit that cannot be exceeded for any reimbursement. However, the limit can be different in different regions (suppose each geographic region has its own ICP4A deployment). Moreover, the limit will change over time if your company policy change. With that in mind, you definitely do not want to create different versions of the same App for different region. It is also not desirable to
require you to go back to development environment to update the App and republish the App just to have the limit adjusted when the company policy change.

The above is just an example of a very common and simple requirement. One solution is to have a way for you to configure your App after the deployment. Any change to the configuration can be done in the deployed environment without the need of going back to development environment to update the App and/or to republish the App.

Environment variable in IBM Business Automation Application is designed exactly for this purpose. You create environment variable when you design your App. You then use the environment variable in your App or Action. Environment variable can be updated easily in any environment by administrator after the App deployment.

It is very simple and easy to use and take advantage of environment variables in your App. While you author your App in App Designer, you can create environment variables in the "Environment Variables" tab of "Application Project Setting" page. For the expense reimbursement App example, you can create an environment variable, named "limit", as follow:
Create environment variable



You can use the "tw.env" namespace in your Action script to access the environment variable. For instance, the "limit" environment variable can be accessed in the Action script step as shown:
Use of environment variable in Action script


You can also use the environment variables in your App that is running in the browser. Unlike Action (which runs on server), environment variables are not by default accessible in your App running in the browser. It is because some environment variables can be considered confidential and should not be sent over the wire. Therefore, in order for the App running in the browser to access the environment variable, you will need to explicitly specify the environment variables you like to be accessible for the App in the browser. You can do that in the "Variables" tab in your App:
Adding environment variable to App

Environment variable added to App


Once you add the environment variable into your App variable list, in the client-side script of your App, you can access the environment variable similar to how you access from your Action script. For example:
Using environment variable in App client-side script


That's it! Once you App is deployed to any testing/staging/production environment, administrator can update the value of the environment variable in Navigator.




You can find more details about the App's environment variable in the knowledge centre https://www.ibm.com/support/knowledgecenter/SSYHZ8_20.0.x/com.ibm.dba.appdesign/topics/t_setting_env_vars.html

I appreciate any comments or feedback, using the comment function below.

#BusinessAutomationStudio
#BusinessAutomationWorkflow(BAW)
#CloudPakforBusinessAutomation
#environment-variable
#Featured-area-1
#Featured-area-1-home
0 comments
67 views

Permalink