How to retrieve a System Property value in a busines process in BPM Suite 6?

Solution Verified - Updated -

Environment

  • Red Hat JBoss BPM Suite 6

Issue

There is a need to retrieve an URL value set as a system property in a standalone.xml file in a business process (i.e. User Task or Script Task).

Resolution

You can set the URL as a system property in standalone.xml as follows:

   <system-properties>
      ...
      <property name="customurl" value="URL_HERE"/>
   </system-properties>

After that, you can retrieve that value in a Script Task or in On Entry Actions and set it to a process variable by using the following code:

 // retrieving the system property set in standalone.xml
 String customURL = System.getProperty("customurl");

 // printing the value out
 System.out.println("customURL: " + customURL);

 // setting the property value in the process variable url1, so you can map it to the the data input variable
 kcontext.setVariable("url1",nameUrl);

Finally you can map the process variable url1 to a task variable.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.