Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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!

0 votes

Comments

I'm sorry Ralph. I created a Calculated Value.

PS: I edited the question.

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.


Keep in mind, change one thing at time, so you would be able to know if such change works or not. 



2 answers

Permanent link
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.

/*******************************************************************************
 * 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";
			
        }
    });
})();

0 votes


Permanent link
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.

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,935
× 7,494
× 152

Question asked: Sep 23 '15, 10:25 a.m.

Question was seen: 4,402 times

Last updated: Sep 24 '15, 3:20 a.m.

Confirmation Cancel Confirm