Dynamic adaptation of Coach Views in IBM BPM v8.0

In a previous blog, we have shown  how to create a basic coach view. Since then, I have been doing some more experimenting to achieve dynamic adjustment of view components. It’s hard to admit, but I have spent quite some time, figuring out how to dynamically hide, show or disable a certain view component (e.g. text box), based on a value of a defined configuration option. In my defense, current IBM documentation didn’t offer as much help as it should.

Here is the scenario. If we return to our Process Order bpd and Order business object from aforementioned example, order is processed in several steps and at each step different properties should be accessible. For instance, when submitting a new order, only description and value should be visible and editable, while id should be hidden as it has not yet been assigned and initial order status should either be read-only or also hidden. However, after order has been submitted and it is supposed either to be approved or rejected, id and current order status must be assigned and visible, while value and description should not be allowed to change anymore. To solve this problem, we could design a separate coach view for each human task, but that would basically annihilate the benefits of using views as such. Therefore, we should use view’s configuration options for dynamic adjustment of the same view in different human tasks.

OrderView coach view, along with control id of each included component, is shown in figure 1. Later, we will use these ids to access required component.

Coach View with control ids

Figure 1: Coach View with control ids



Open OrderView coach view and move to Layout tab. Because id and status in our example are automatically generated, we will statically set both fields to read-only by selecting each of them and selecting Read Only for Visibility option under Behavior section in General Properties tab, as shown in figure 2. Description and value field should retain their Default (inherit from parent) option.

Static behavior visibility options

Figure 2: Static behavior visibility options


Now we move to dynamic adjustment. First, we need to define configuration options. Therefore, move to Variables tab and add two Configuration Options, namely idAndStatusVisible and descriptionAndValueEditable, both of type Boolean, as shown in figure 3.

Configuration Options

Figure 3: Configuration Options


To dynamically adjust visibility of components based on above defined configuration options, we move to Behavior tab and select View under Event Handlers. Here we can add custom code, as shown in figure 4.

Behaviour code for hiding and disabling components

Figure 4: Behaviour code for hiding and disabling components


this.context.getSubview(“view_id”,true)[0]; is used to access a first subview with a specified id,

this.context.options.descriptionAndValueEditable.get(“value”); is used to access value of defined configuration option,

n2.context.setDisplay(false); is used to hide selected component and

n4.context.options._metadata.visibility.set(“value”,”READONLY”); is used to disable editing of a specified component.

Therefore, our view is prepared and all that is left is to set the defined configuration properties when including this view in a coach on a specific human task. When we add coach view to human task, we can set values for each option under Properties in Configuration section, as shown in figure 5.

Human task Coach View configuration

Figure 5: Human task Coach View configuration


The final result when running each task is shown in figure 6.

Final gui view

Caption 6: Final gui view


RSS Feed

6 Comments for Dynamic adaptation of Coach Views in IBM BPM v8.0

Latha | August 15, 2012 at 3:26 pm

Thanks for posting this example I tried this example and I got 404”s Button.js, Text.js, OrderView.js and Vertical_section.js ..??!!HELP!
I’m also struggling to get simple validation working on the coach 8 please help! thanks

Naaz | April 23, 2013 at 6:14 am

Hi Gregor,

By any chance did you try hiding or making readonly a specific row within a table based on some given condition? For ex: u have a table “Enter Marks”. To this a complex BO “Student(List)” is binded. Student has Name and Marks. Name is output text(say fetching from database and populating it) and Marks is input text. The marks text box adjacent to name should be editable only for the student who has entered into process. For other students the Marks text box should be readonly.
Kindly share the solution please.

Jester | November 25, 2013 at 5:46 pm

Oh Thank you, it worked;
But I have a question,
If I dont need to use the “setDisplay” method and I need to set the “width” of an input text , is there any other pre-build method?

I’m sorry if my question is stupid I just started with bpm last week!

wili | October 25, 2014 at 1:42 pm

estoy empezando en el desarrollo de cach view, deseo un buen libro de guia

wili | October 25, 2014 at 1:43 pm

I’m starting to develop cach view, I wish you a good guide book

Beatris | September 1, 2016 at 5:40 am

If you are interested in topic: do groups make
money on facebook – you should read about Bucksflooder first

Leave a comment!