Javascript (Calculated Value) is not called when workitem is created neither is saved
Hello.
I need a help... The article https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Configuring_a_script_based_custo (Calculated Value Section) says :
"If you configure a Script-based calculated value, the script will be executed in three cases:
When a work item is created, the script is executed
When a work item is saved, the script is executed to recalculate the value.
When an attribute which the current attribute depends on is changed, the value of the current attribute is recalculated. Depending on the presentations of the two attributes this may not work in all cases."
I created a script, but only works when an attribute which the current attribute depends on, is changed!
I put my browser in debug mode(https://jazz.net/library/article/1360), but o script only stops in breakpoint for the third situation.
Does someone knows why?
Thanks!
I need a help... The article https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Configuring_a_script_based_custo (Calculated Value Section) says :
"If you configure a Script-based calculated value, the script will be executed in three cases:
When a work item is created, the script is executed
When a work item is saved, the script is executed to recalculate the value.
When an attribute which the current attribute depends on is changed, the value of the current attribute is recalculated. Depending on the presentations of the two attributes this may not work in all cases."
I created a script, but only works when an attribute which the current attribute depends on, is changed!
I put my browser in debug mode(https://jazz.net/library/article/1360), but o script only stops in breakpoint for the third situation.
Does someone knows why?
Thanks!
2 answers
Pietro,
I think the description is correct, I am not sure if your debugger can block on the call for creation and save. Mine (Chromium) couldn't. The trigger worked on the change of the dependent attribute only. But I was able to see that the script was run at all the occasions. I configured the description and another attribute (severity). I saw Test in the description, after the work item was created. I saw TestTest after saving, changing the severity added another test.
I think the description is correct, I am not sure if your debugger can block on the call for creation and save. Mine (Chromium) couldn't. The trigger worked on the change of the dependent attribute only. But I was able to see that the script was run at all the occasions. I configured the description and another attribute (severity). I saw Test in the description, after the work item was created. I saw TestTest after saving, changing the severity added another test.
/******************************************************************************* * Licensed Materials - Property of IBM * (c) Copyright IBM Corporation 2011. All Rights Reserved. * * Note to U.S. Government Users Restricted Rights: * Use, duplication or disclosure restricted by GSA ADP Schedule * Contract with IBM Corp. *******************************************************************************/ dojo.provide("com.example.ValueProvider"); (function() { dojo.declare("com.example.ValueProvider", null, { getValue: function(attribute, workItem, configuration) { return workItem.getValue(attribute) + "Test"; } }); })();
If I'm not mistaken, the script is executed on the server side for the first two cases, so you cannot set breakpoints in it on the client side (the browser). To debug, use console.log() and check the output in the Eclipse .log file on the server. This file can be found as /opt/IBM/JazzTeamServer/server/tomcat/work/Catalina/localhost/ccm/eclipse/workspace/.metadata/.log on Linux with the bundled Tomcat.
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Sep 23 '15, 10:44 a.m.What type of customization?
See How should I ask a question in the Forum if I want to receive useful answers?
Pietro Bottino
Sep 23 '15, 10:50 a.m.I'm sorry Ralph. I created a Calculated Value.
PS: I edited the question.
Tiago Moura
Sep 23 '15, 11:02 a.m.I suggest you to start simple, put only a log message in your code. Check the execution using a debug tool. Is it working? Step forward, implement a more complex code, test and repeat the process.