Has anyone else run into problems with Script based attribute calculated values in RTC 5.0 web?
We have a script based Calculated Value attribute customization that will set the state of a work item to In Progress whenever a non-zero time spent value is set while the state is new (basic behavior). This worked fine in 4.0.2 from the web and works fine in the Eclipse Clients in 5.0.1. However, when trying to exercise this code from the web for 5.0.1, I am getting errors. I am using Firefox 31.0 ESR and IE 8.0 as my web browsers. The error I get in Firefox is:
Error: com.ibm.team.repository.web.transport.ServiceRequest(): invalid requestParameters parameter: [object Object] The error from IE is basically the same: Message: com.ibm.team.repository.web.transport.ServiceRequest(): invalid requestParameters parameter: [object Object] Line: 21518 Char: 1 Code: 0 URI: https://gdccm01.gddsi.com:9443/ccm/web/_js/?include=F~&etag=JYhtNwwjKTa_en_US&_proxyURL=%2Fccm&ss=FjqrT&locale=en-us --- The code in my script is included below: dojo.provide("com.gdc4s.rtc.ValueProvider.TimeSpentStatusUpdate"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); |
One answer
Ralph Schoon (63.5k●3●36●46)
| answered Jan 23 '15, 2:25 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
It might also make sense to wrap your code with a try catch block to see where the error happens exactly.
Another thought is: why do the state ID's look so different? If a work item is in the new state, the state is null (at least in Java). After the save it is "New". You might want to test for this and take it into consideration. Comments
Jamie Berry
commented Jan 27 '15, 11:33 a.m.
I tried adding try/catch blocks and it actually doesn't catch any error... I also stripped my script down to just 2 statements - get the current state and return that as the value. This resulted in an error still being thrown. Actually, the error is thrown multiple times (2+ -- seems to vary). It seems the script is invoked multiple times, the first time goes through with no error but somehow causes a chain reaction of follow on errors. This worked fine in 4.0.2...
Calculated value provider are called multiple times, based on changes in attributes they depend on. This is quite normal.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
Additional information. I have 2 other calculated value scripts that work okay. The other two apply to a Date field and the corrected estimate field. It might be possible that the issue is with the attempt to set the state of the work item...
Okay, I put some console.log statements in and ran again in Firefox with the console showing. Here is what I received (truncated ... to fit)
"In TimeSpentStatusUpdate" _js:26
"internalState = 2, tspent = 1800000" _js:33
"newState = 2" _js:48
"Problems executing value provider for {0}: state is null. .getValue@https://gdccm01.gddsi.com:9443/ccm/web/_js/?exclude=F&include=com.ibm.team.workitem.web.ui.internal.page.WorkItemPageView&ss=FjqrT&_proxyURL=%2Fccm&locale=en-us line 27449 > eval:28:1
.getValue...
"Problems executing value provider for {0}: state is null...
"In TimeSpentStatusUpdate" _js:26
"internalState = null, tspent = 1800000" _js:33
"newState = null" _js:48
"Problems executing value provider for {0}: state is null...
"In TimeSpentStatusUpdate" _js:26
"internalState = null, tspent = 900000" _js:33
"newState = null" _js:48
...
It appears that somewhere in the middle a variable gets a null value. I have found that JavaScript can get different results when running on client side comparing to running on server side, probably due to the different JavaScript engine.