Troubleshooting
Problem
Coach Views that are bound to complex objects (both data binding and configuration binding) might contain stale data when the runtime flow returns to a Coach that contains these Coach Views.
Cause
The runtime flow returns to the Coach through a stay on page node or connection. The stale data occurs only when complex objects, such as a business object of a complex type, are re-initialized on the server side. The Coach views are not notified of this re-initialization and, as a result, do not refresh their data. That is, a server-side tw.local.var1= new tw.object.BO1() means that Coach views that are bound to the business object (BO) might have data that is out of sync with the server. Coach views that are bound to simple type properties of the complex object are notified of changes (for example, tw.local.var1.property1="changed").
For example, CoachView1 is bound to BO1 and CoachView2 is bound to BO1.property1, which is a simple type such as String or Integer. If you re-initialize BO1 on the server and the flow returns to the Coach that contains CoachView1, CoachView1 is not notified of this change. However, if the re-initialization of BO1 changes BO1.property1, CoachView2 is notified of this change to BO1.property1.
Resolving The Problem
To make your Coach view aware of changes to a complex object, use one of the following techniques:
- Create a callback to capture changes to the complex object:
- In the load() event handler of the Coach view, add the following code:
this.context.binding.get("value").bindAll(this.myChange, this);
- Define the myChange() event handler in the Coach view JavaScriptâ„¢. Add the logic to handle properties changes.
- In the change() event handler, call bindAll() to rebind to the properties. This step is necessary because the previous binding subscriptions are lost when the complex object is replaced.
- Create a flag to indicate that the complex object has changed:
- Add a variable of a simple type such as Boolean or String to the human service.
- Bind the variable as a configuration option to the Coach view.
- Add server-side scripting that updates the variable when the complex object changes. The change in the configuration option variable invokes the change() event handler for the Coach view.
- Add code to handle the changes in the complex object.
Product Synonym
BPM
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21638401