In TIBCO, we use Global Variables to store certain variable data which we can configure at runtime while deploying our applications. Global variables are accessible in all the processes in a TIBCO BW project. While adding a new Global Variable in TIBCO, we can have following types available:
Variables stored as type Password in Global variables have a problem associated with them that they are not directly accessible inside TIBCO BW process under $_globalvariables.
In this TIBCO tutorial, I will explain step by step how you can use Java Code activity inside your business process to get password data and then use it in your BW process.
Step 1: Create a Global Variable of Type Password
In your BW project, go to Global Variables and using the Pencil Icon, create a new Global Variable and set its type as “Password”. In this example case, I have created a password type GV with the name MyPassword. I have set its value “ajmal” which is not visible in the below screenshot as TIBCO is only showing it as password data.
Step 2: Create Process and Use Java Code Activity to get the password data:
Create a new TIBCO BW process GetPassword. In this process, we will use Java Code activity. In Java Code configuration, I have added a new Output Parameter to which Global Variable value will be saved while using Java code.
In the Code, write the following Java Code to get the value of password Global Variable:
Now Press Compile Button. As you can see in below screenshot, code has compiled successfully.
As we are using myVar variable which we created as Output Parameter, we can see in the Output tab that Java Code activity will give its output in this variable once it is run.
Step 3: Test The Process to Get Global Variable Password Value:
Now validate the process to make sure there is no error. Once validated successfully, we are good to go to test the process. Load the process in the designer tester. As you can see in below screenshot, code has run correctly and Java Code has successfully retrieved Password value from the global password type variable. The value is same that was set while creating the global variable.