It's all about the answers!

Ask a question

How to get calculated attribute value script to run in browser for debugging?

Robert Huet (23112179) | asked Jul 19 '16, 11:38 p.m.
 I have read a number of posts and articles that say that calculated attribute scripts can be run and debugged in the browser (using Chrome or FireBug debugger tools).  Even though I have added the "?debug=true" parameter and been able to set break points on the attribute script, when the script runs, it never hits any break points, and none of the "console.log" statements appear in the browser console.  The only place I have been able to see any "console.log" output is on the server .log file.  So I am convinced that the script is running on the server and not on the client.

I would love to be able to debug my script in the browser.  How do I get it to run on the client side?


Donald Nong commented Jul 21 '16, 5:06 a.m.

The script can run on both the client and server. It is possible that your script does not get triggered when using Chrome. Check the console for other errors even they seem unrelated.

2 answers

permanent link
Ralph Schoon (62.0k33643) | answered Jul 20 '16, 2:37 a.m.
For all I can tell, the calculated values run in the client, especially in the web client. You can set breakpoints and debug them. I prefer the Chrome Development tools for debugging these scripts.

Robert Huet commented Jul 20 '16, 10:02 a.m.

 If that's the case, why is it that my console.log statements only appear in the server's .log file?  Also, the break points I've set in my script in Chrome never get hit, and none of my console.log output shows up in the Chrome console.  I've tried this in 2 different CLM 5.0.2 environments with both Chrome and FireBug.  I really don't know what else to try.

Has anyone else experienced this?  The last time I did attribute script development was with RTC 3.x, and I had no problem getting the console.log output to show up in my Eclipse console.  Now it won't even go to my Eclipse .log file, but only appears on the server's .log file.  The script is running successfully, because my attribute value is getting set in RTC.

I would appreciate any ideas you might have on what I should try next.

Robert Huet commented Jul 20 '16, 11:38 a.m.

 Just tried the same thing on a CLM 6.0.1 instance.  Still not able to get debug working in Chrome.

I installed a plain zip version of the RTC Eclipse 6.0.1 client, though, and was able to see my "console.log" output in the Eclipse "Error Log" view.  So at least that's some progress. :-)

Robert Huet commented Jul 20 '16, 2:12 p.m.

Wow, the "console.log" output is also behaving strangely in Eclipse 6.0.1.  When I create a new work item in Eclipse, the "console.log" output show up in the Eclipse"Error Log" view.  These also show up in the local workspace .log file.  However, with all subsequent updates to the work item, the "console.log" output only shows up in the server log (nowhere else).  This is not helpful when working in environments where I don't have access to the server.

Ralph Schoon commented Jul 20 '16, 2:14 p.m.

You have to debug in the Web UI and not in the Eclipse UI - obviously. The Eclipse UI does not use Chrome, and you can not debug there at all, except Java Based extensions.


Ralph Schoon commented Jul 21 '16, 2:56 a.m.

Works like a charm for me. Calculated value, dependency set to Summary.
?debug=true set for debugging. New work item created. In debugger browsed to script and set break point. Entered data in summary, changed focus and the breakpoint hits.

RTC Version 6.0.1 The tool is fine, the problem seems to be what you are doing.

Robert Huet commented Jul 21 '16, 11:39 a.m.

 Thanks for checking it out in 6.0.1, Ralph.  I will keep playing with it till I figure out what I'm doing wrong.

showing 5 of 6 show 1 more comments

permanent link
Robert Huet (23112179) | answered Jul 22 '16, 4:30 p.m.
 Turns out that you can only use the browser's debugger when your calculated attribute has a dependency on another attribute, and the user manually changes the value of that attribute in the UI.  If you have a calculated attribute that does not depend on another field (like capturing the date of a status change), then the script only runs when the work item is saved, and it runs on the server not the client.  The only way to debug this is to check the "console.log" output in the CCM.war's Eclipse log file.  I'm beginning to think that any attribute calculations that depend on a status change would be better handled in a work item save post-process action.

Your answer

Register or to post your answer.