Handling SOAP Fault in IBM BPM webserivce integration

This is one area which most of us including are under the impression that SOAP Faults can not be handled with the web service integration of IBM BPM. It is very much untill the version8.0, but the support has been provided starting from v8.0.1. The link below tells you on high level on how to capture the soap fault using the error event in IBM BPM.
IBM Knowledge Center.

your WSDL operation looks like this, similar to what is shown in the above link.
Operation Element in WSDL (Fig - 1)

What does this link won't tell you and you need to know in order to make this work ?


IBM BPM - How to get the Server HostName and Port in different Environments

In this Post, let us look at how to retrieve the Server host name and port in different environments. The general practice is to use an environment variable for host name and port which can be used to hold these constants and change these values when you promote the code to higher environments.
I found a way  to retrieve these values programmatically using  the apis that comes with IBM BPM, just thought of sharing that with you all. Below is script which will fetch these values dynamically.

Above statement gives the instance of the server.

server.getServerHost() - This gives the Host Name of the BPM server.
server.getServerPort() -  This gives the port of the BPM server

Above statement gives the portal prefix


IBM BPM - Send an Uploaded File as an Attachment in Email

In this post, let us look at how to write a file attached in IBM BPM (to an ECM ) on to the file system and send that file as an attachment in the email Notification.

 Below are the assumptions or Prerequisites for this illustration:
  • BPM uploads the document attachments to an ECM document store.
  • A folder already created and folder id is generated (Of course using the services available in Content management Toolkit !! ) in the ECM for a given application.
Below are the steps involved:
On a high level, this solution can be divided in three parts such that: a) Retrieve the file from content store (ECM), b)Write file to a file system, c) send the email by providing the file location to email service.

Let us look at this solution in details.


Working with Reg Ex in IBM BPM

In this post, let us look at some of the commonly used server side data validations using the regular expressions and how to use them with the BPM variables. I am providing ready use methods for some of the commonly used Reg Ex validations in this post just for your reference for future use when ever required.

Reg.Ex for Email Id 

/*  This method will verify if the input string is a valid email Id or not and return true for valid email and false for invalid email */ 
function isEmail(str){
     if(str!=null && str!=""){
        var emailRegEx=/^\w+[\w-\.]*\@\w+((-\w+)|(\w*))\.[a-z]{2,3}$/g;
         return str.match(emailRegEx);
         return false;

Reg.Ex for URL

/*  This method will verify if the input string is a valid url or not and return true for valid url and false for invalid url */
function isGoodUrl(str) {
    var regEx=/(^|\s)((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?)/gi;
    if(str!=null && str!=""){       
                    return str.match(regEx);
                   return false;

Reg.Ex for trimming of trailing spaces

/*  This method will verify if the input string is a valid email Id or not and return true for valid email and false for invalid email */
function trim(str){
                 return str.replace(/^\s+|\s+$/, '');
                 return "";

Having defined these methods in the either js file which is added as server file in File section in PD and can be used globally across the application or these can be defined locally in a server script and can be invoked at that server script level as below.

For trim:  tw.local.str = trim(tw.local.str);
For URL: tw.local.isURL= isGoodUrl(tw.local.url)
For Email : tw.local.isEmail= isEmail(tw.local.emailId)
Hope this post is helpful !!

working with documents in IBM BPM

Document upload and download is one of the import use case in the BPM processing. In this post let us look at how to upload a document from the process instance during the process and retrieve the documents corresponding to a given process instance in a standalone human service? What is mechanism used to store the documents in IBM BPM.

In IBM BPM documents are stored using a document store (Out of Box ECM) provided by IBM BPM. It is also possible to connect to an external ECM from IBM BPM. IBPM suite provides a toolkit out of box called Content Management Toolkit which contain some predefined services and coach view to upload and access the documents to and from the IBM BPM document store. The coach view Document List can be used to upload the documents to IBPM document store or for that matter to any External ECM system which is CMIS compliant. In this post let us look at how to upload the documents to IBPM document store from process instance and associate those documents with some unique parameters such as process instance Id and retrieve them in a standalone screen based on the document parameter ( In this case let us use instance Id as document parameter). Below image shows the image of Document List Coach View from Content Management Toolkit. 


Confirmation Dialog on Click of a Button in IBM BPM

In most of the UI applications, display of confirmation dialog when trying to delete some data or cancel the current operation is a very common use case. In this post, let see how to create a coach view with a button which will do this. Below Image shows the confirmation dialog on click of the Delete button.

Confirmation Dialog on Click of Delete Button


Confirmation Dialog Coach View in IBM BPM

Display of Confirmation dialog is one of the very common use cases in any UI based application in such as "delete" operation, "cancel" operation etc. In this post let us see how to create a coach view which can used to display a confirmation dialog as shown below.

Confirmation Dialog
Figure 1


How to assign a Team or User to an activity dynamically in IBM BPM

From IBM BPM v8.5, the Assignment options which were there before such as "Last User in the lane", "Routing Policy",  "List Of Users" and "Custom" were deprecated an can no longer be used for the Task Assignments. In older version the option "Custom" was being used for dynamic assignment of Team or User to a Task. In the latest versions of IBM BPM i.e., from V 8.5.0 a new way of assignment has been introduced i.e., using the "Team Filter Service".

In this post, let us look at a code sample illustrating the Dynamic task assignment for user using Team Filter Service.

As a first step create a simple BPD with one Activity with a Human Service. Click on the activity and navigate to Properties --> Assignments and click on new in-front of  "Team Filter Service" to create a new Integration service (team filter service) as shown in below figure or select an already created service.


How to use server side variable in custom html script of IBM BPM Coach

In this post, let us look at how display the value from a server side variable on a coach using custom html.

In older versions of IBM BPM i.e., before v8.0 it is easier to both bind a server side variable and access value of server side to a custom html using the syntax tw#local#variable using which a variable can be bound to any input control of the custom html which enables us to get or set the value to or from the variable.
But starting from the v8.0 after the introduction of new coaches and coach view, the above syntax no longer works and it is also not possible to set the value to a server side variable directly from the input control but it is possible to get the value using the below syntax.

Directly in coach :

In Coach view :
 To Access business Data variable:

 To Access configuration variable:


Key Differences between IBM BPM Process Management & Case Management

IBM Business Process manager (BPM) advanced v8.5.5 is now offering basic Case management in its BPM Suite. The basic case management solution is derived from one of the IBM’s offerings called “Case Manager”. It also includes an embedded content repository whose usage is restricted to support the basic case management documents & folders. The restricted use of this content repository can be extended to support unlimited content management use cases with IBM ECM.

Key Differences between Process Management & Case Management

Below are some of the key differences between business process management and case management.


Working with JSON in IBM BPM

Now a days REST protocol has become very popular for interaction between various system. REST services support both json as well as xml as i/o. In this post, I would like to illustrate with an example on how to parse the json response / json object to retrieve the data and assign it to a tw variable by using json2.js file.
Let us first attach the file json2.js to the files sections under server files as shown below.

Figure 1


Performing REST Call from IBM BPM server Script

IBM BPM provide a connector "read from http" in system toolkit to invoke the REST service call. This connector supports both get and post methods while invoking the REST Service. But the disadvantage with this is that it will support only when the input is in the form of either query parameters or form parameters, but not when the input has to be sent as Entity to the REST service.
In this Post, I would like to illustrate an example on how to perform a rest call which where the input has to be passed an entity  instead of name and value as illustrated in my other post.

Below is the xml input which has to be passed to the rest service. let us use a server scriptlet to bind this input xml to the variable tw.local.inputString.


<Reqest><control>420131</control><suffix>10</suffix> <account>1</account><planData><planNumber>21</planNumber><planEffectiveDate>2014-01-10</planEffectiveDate></planData></Request>

Below code can be to invoke the rest service by passing the necessary input to the service call. 

var client =new Packages.org.apache.http.impl.client.DefaultHttpClient();

var input =new Packages.org.apache.http.entity.StringEntity(tw.local.inputString);
var post = new Packages.org.apache.http.client.methods.HttpPost(tw.local.restserviceurl);
var response = client.execute(post);
//var entity = response.getEntity();
tw.local.output = Packages.org.apache.http.util.EntityUtils.toString(response.getEntity(),"");

Below shown is the xml output the above response, which is in String format.

<Response>   <getCount>    <planNumber>21</planNumber>
    <planEffectiveDate>2014-01-10</planEffectiveDate>     <subscribers>0</subscribers>     <members>0</members>  </getCount>   <getCount>    <planNumber>0</planNumber>    <planEffectiveDate />    <subscribers>0</subscribers>    <members>0</members>  </getCount>  </Response>

After getting the response as a string, you can convert that to XML as below:

tw.local.response = Packages.com.lombardisoftware.core.XMLUtilities.stringToElement(tw.local.output);

you can also refer the post on how to convert XML string to XML.

Hope this post is usefull !!!

Thanks for stopping by. If you like this post leave a comment, share it and do a g +1.

Server side Caching in IBM BPM with jsCache

Many of us might come across this requirement of server side caching mechanism in IBM BPM, especially when the applications are UI heavy, involves lots of users or expensive data preparations. In these kinds of scenarios Caching comes to rescue in-terms of improving performance by avoiding expensive operations like database calls or web service calls to fetch the commonly used or rather static data (which doesn't change more often) that needs to be displayed on to the UI. In IBM BPM, there is beautiful option for this called jsCache.
How jsCache works? 
jsCache stores data server side as mutli-level javascript Map (Key-value pair), with the first level being the name of the cache and map of the values to be stored corresponding to that cache name. Each data key in a given cache can be associated with an expiry time (optional though), so that the cached data can be refreshed at regular intervals of time. Figure 1 helps illustrate the storage of data in jsCache,

Figure 1: illustration of jsCache
You can download the jsCache.js file  by clicking here.


IBM BPM Coach Validation with Multiple Buttons

In this post, I would like discuss about an issue with Coach Validation when there are multiple button validations available in a single Coach and possible solution for the same.

First let me describe the issue.
I have a coach which has three buttons, Button1, Button2, Button3. On click of each button, field validation should happen for the fields corresponding to each button. you can go through my other post related to UI Validation to understand on how to do validation in IBM BPM.
In the below image, 'tick' mark for each transaction (line) indicates that validation should be performed on click of that particular button. Unfortunately, even though validations has to be performed for multiple buttons, all the validations should be handled in a single Validation Script (you can notice in the Figure 1 that there is only one validation Script). In order to validate the fields corresponding a button, we need to identify which button is clicked up on. To identify the button clicked up on, we can bind a Boolean variable to each button  as shown in Figure 2 and on click of the button, the bound variable will be set to true.  In the validation Script, we can verify this button variable (Boolean) and if true, then validate the corresponding fields for a particular button.
Figure 1

IBM BPM Coach View life cycle

This post will give you a brief description about the life cycle of IBM BPM coach view and helps understand what are the various event handlers available in coach view and high level description of each coach view.


Click here to watch this video in you tube.

Hope this is helpful to understand coach view at high level. 

How to Add time lag in IBM BPM service

While developing an application in IBM BPM, when we think of time lag first thing that comes to our mind is "Intermediate Timer Event". Yes this is correct. This work well in BPD, but how do you implement a lag during a service execution. Don't have an answer for this? Well, in this post lets look at a simple solution on how to add a time lag during a service execution.

Many of us already know that we can use some of the java classes directly in BPM server script component, here we are going to use the same technique to achieve this. Below image shows how to implement the same.

Add the below line in the server script as shown in the image to introduce a delay time between two logic executions. The method sleep() takes time in milliseconds as input.

java.lang.Thread.sleep( <<time in millseconds>>)

That is all we are good now with the desired delay in our service.

Hope this helps !!! 
Thanks for stopping by. If you like this post leave a comment, share it and do a g +1.

How to Access Coach View element in Custom HTML - Part 2

This blog is continuation of my other blog - How to Access Coach View element in Custom HTML .
In this blog, let us see how to access various Stock coach view (check box, integer, combo box, radio button, etc) element's values.

Check Box Coach View

Consider a Check box coach view with control-id "checkbox_1",below is the code that can be used to access the value of the coach view. Below code attaches onClick event to the checkbox and on click of the check box, it gives a popup with value of check box as shown in the figure below.

require(["dojo/ready", "dojo/query","dojo/on"],function(ready, query,on){
     // Check Box element
  var check=query("div[data-viewid='checkbox_1'] input[role='checkbox']")[0];
           on(check, "click", function(){


Best Practices while implementing BPD using IBM BPM

Hi Guys in this post I would post some of the industry best practices that can be followed for a good process Design while designing using IBM BPM.

Below are some of the best Practices for development of a high performance business process using Process Designer.

  •  Clear variables in exposed human services
Data from a task less human service is not garbage-collected until the service reaches the endpoint. If a human service is developed that is not intended to reach an endpoint, such as a single page or redirect, then memory is not garbage-collected until the Enterprise JavaBeans (EJB) timeout occurs (two hours by default). To reduce memory use for these human services, set variables in the coach to null in a custom HTML block.

  •  Do not use multi-instance loops in system lane or batch activities
Where possible, avoid using sub-BPDs as the activity of a multi-instance loop (MIL). This step is not an issue if the first activity is a user task instead of a system lane task. However, do not use MILs for batch or system lane activities.This pattern can generate an excessive number of tokens for the BPD to process. Also, activities in MILs in the system lane are run on a single thread, which is clearly not optimal on multiprocessor core servers.


Enable Column Show/Hide for Gridx Table Coach View in IBM BPM

This is post will be useful for those who want to extend Grid Table from Kolban TK with show/Hide columns functionality.

Gridx Table from Kolban TK has awesome functionality packed with it, but am not going in detail about all of it. You can check this by going through the bpmwiki url for Gridx Table. I would like to give details on how to customize the Gridx Table to add show/Hide columns functionality.

Below are the steps to do the customisation:

1. Gridx API provides a module to show/hide columns in the grid (table). we need to add that as an AMD dependency to the Coach View as shown in the below figure.

2. Now go to the Variables tab and add a variable hideColumns in the Configuration Options, which will accept a comma seperated string of column numbers to hide. Below image shows the variable to be added under configuration options.


How to Access Coach View element in Custom HTML

Many of ibm bpm developer out there including me are wondering on how to gain control (access) over coach view elements in the coach from the Custom HTML using script. This use to be very easy in the 7.x versions of the IBM BPM where there is no concept of coach views. But even in 8.x version of IBM BPM with the introduction of coach view, it is bit tough but not achievable. After a bit of research I am able to achieve this. Just though of sharing it with you all.

In this post, let us see these two simple scenarios:
  • how to access a button coach view element and add an onclick event to it.
  • how to access an input element and read the value of the input element.

In the coach add a customHTML , inputText and Button coach view from the pallet on the right Side as shown in the below figure.
 Once added, check the control Id of the Input text and Button coach views (edit the same if you want to give a meaning full name to the control id)as shown in the below. This control Id is very important in order to access the UI element. In coach transformation this control id will be transformed to data-viewid (you can find this by looking at the html source of the page)


Please Wait dialog Coach view in IBM BPM

Please wait Dialog is one of the common and useful UI features which is needed and helpful when there is a significant time consuming back ground operations involved while navigating between one screen to other screen.

In this post, let us see how to create a coach view which shows a Please wait dialog as shown in the below figure, when some back ground operation is happening while moving from one screen to another / while loading some data to the same screen.

Please Wait Dialog in the Coach

First Step to create this coach view is to search the web and find the animation (.gif) for Please wait Dialog. Once you find that, add the same under the files section in the Process Designer  as a web file as shown in the below figure.


Export to Excel in Gridx Table Coach View in IBM BPM

This is post will be useful for those who want to extend Grid Table from Kolban TK with Export to Excel functionality.

Gridx Table from Kolban TK has awesome functionality packed with it, but am not going in detail about all of it. You can check this by going through the bpmwiki url for Gridx Table. I would like to give details on how to customize the Gridx Table.

Before starting the customization, it is always a good idea to copy the artifacts from toolkit to your Process App . In the Export to Excel we are going to use "data-redirect.jsp", which comes out of box with IBM BPM and feed csv data from the table and export it  as excel. Here is how we do it.

Step 1:
We need to add two AMD dependencies as shown in the below figure: