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:
- String
- Integer
- Boolean
- Password
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:
myVar=com.tibco.pe.plugin.PluginProperties.getProperty(“tibco.clientVar.MyPassword”);
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.
The above code is not working, can you send a.zip version your for reference over email mentioned?
Hi Raj,
The Code works absolutely fine.
I tried in my system and it worked.
Can you tell me the issue faced ??
Thanks.
In ‘Setp2’, Inaddition to adding Output Parameter in Configuration tab, Need to add Input Parameter.
Then in Input tab of Java code activity, Input Parameter added will be displayed. Map the GV for which the password should be retrieved. Make sure the code is complied successfully.
Hi Sheela,
We won’t see the password in GV to map in Input parameter.
Thanks.
Pingback: How to Encrypt Password in TIBCO BW6 With Special Characters
Can you please show the configurations in BW6. Java code activity not available in Bw6.