Tuesday 19 January 2016

Watch out for 'watch' as a variable name in IBM BPM with V8+ coaches

Found an obscure issue the other day at a customer site - writing it up here in case I forget what the details were . .

In summary, if you have a variable called 'watch' in IBM BPM with next gen (V8 and above) coaches, you may see a conflict with dojo stateful https://dojotoolkit.org/reference-guide/1.10/dojo/Stateful.html trying to add a .watch function to your variable. At this point, your coach buttons will stop working - or your coach may not display at all. You will see an error in the browser console of the form 'dojo.watch is not a function'.

Using NG coaches with IBM BPM V8.5.0,1 and above, they were seeing issues in the browser console reporting that '.watch is not a function' and finding that they couldn't press the buttons on the coach.

This appeared to be random with no pattern that they could discern. Some coaches worked, others didn't

The only workaround they could find was to use a heritage (pre V8) coach, where the problem went away.

We did much googling of .watch and dojo.watch etc but couldn't find anything that would explain the 'randomness'

After walking through the process app, we finally spotted that they had a variable called 'watch' in one of the business objects, a couple of levels into the hierarchy.

This variable was sometimes used, sometimes not. In the hierarchy / object graph, that level was sometimes instantiated, sometimes not. When it was in use, the variable reference was object.watch , which conflicted with dojo stateful trying to add the .watch function onto the variable, hence '.watch is not a function'.

Process designer will stop you creating variables with java and javascript reserved words (try creating a variable called 'this' if you want to see it) but it doesn't catch everything. If nothing else, the 'watch' variable was created when the customer was on 7.5.1 and before NG coaches with lots of dojo and the .watch function.

Another one for the 'department of incredibly obscure issues' . ..

No comments:

Post a Comment