Friday, November 8, 2019

Environment variables in BAW Client Side Human service

Abstract:
Using Environment variables defined at Process App/ Toolkit level in the Client Side Human Service in IBM BAW

Problem:
The environment variable values not appearing in Client Side Human Service.

Description:
1. Lets say you have an environment variable created in you process app which you want available across all your services in the app.
2. For instance your Environment variable name is 'applicationId'; if you have any service created in the process app, then using tw.env.applicationId will give you the value present in this variable as result.
3. However, if you have a Client Side Human Service and you want to use this environment variable within this, then you will observe that the value returned will be null.

Solution with Example:

1. I have an application "HRSJ BAW Application" with an environment variable "applicationId" with value "101" and a client side human service "HR Portal".

2. "HR Portal" has an output variable "appId" created

3. "HR Portal" also has 2 activities in the diagram "Init" (script activity) and "Coach" (Coach activity).

4. In "init" script, the value of the environment variable 'ApplicationId' is being assigned to output variable 'appId' with console logs printed to see the value for the ids.

5. In "coach", there is a Text field which has binding as 'appId'.

6. On executing the HR Portal human service, it will be observed that there is no value populated in the text field.

7. This means the environmental variable has not been assigned to appId.
8. On checking the console, I find that the environmental variable "applicationId" also is undefined.
9. On analysis, I find that i will have to add the environmental variable in the variables section of my human service "HR Portal".


10. Now on running the application, the value will be populated in both the UI as well as the console.




No comments:

Post a Comment