TIBCO Tutorial: How to Get Global Variable Password Value Using Java Code

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:

  1. String
  2. Integer
  3. Boolean
  4. 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.

add password global variable

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.

java code output parameter

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”);

java code to get password

Now Press Compile Button. As you can see in below screenshot, code has compiled successfully.

compile java code

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.

java code output

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.

tibco gloabal variable password test

 

 

Ajmal Abbasi

Ajmal Hussain Abbasi is Integration Consultant By Profession with 13+ years experience in Integration domain mainly with TIBCO products. He has extensive practical knowledge of TIBCO Business Works, TIBCO Cloud, TIBCO Flogo, TIBCO Mashery, TIBCO Spotfire, EMS and TIBCO ActiveSpaces. He has worked on a number of highly critical integration projects in various sectors by using his skills in TIBCO Flogo, TIBCO API Management (Mashery), TCI, Tibco Designer, TIBCO Business Studio, Adapters, TIBCO EMS, RV, Administrator, TIBCO BE, TIBCO ActiveSpaces etc. Ajmal Abbasi has experience with MuleSoft ESB as well. Ajmal Abbasi is also experienced in the area of API Management particularly with WSO2 API management platforms. Ajmal Abbasi is also experienced in developing solutions using Core Java and J2EE Technologies. You can contact Ajmal Abbasi for Consultancy, Technical Assistance and Technical Discussions.

More Posts - Website - Facebook - LinkedIn - YouTube

6 thoughts on “TIBCO Tutorial: How to Get Global Variable Password Value Using Java Code

  1. Raj

    The above code is not working, can you send a.zip version your for reference over email mentioned?

    Reply
    1. Rahul

      Hi Raj,

      The Code works absolutely fine.
      I tried in my system and it worked.
      Can you tell me the issue faced ??

      Thanks.

      Reply
    2. Sheela

      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.

      Reply
      1. Ken

        Hi Sheela,

        We won’t see the password in GV to map in Input parameter.
        Thanks.

        Reply
  2. Pingback: How to Encrypt Password in TIBCO BW6 With Special Characters

  3. Vikram

    Can you please show the configurations in BW6. Java code activity not available in Bw6.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *