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

Work item attribute calculation script getting triggered even when dependent field has not changed

In the property dialog of a custom work item attribute, I can specify dependencies on other attributes so that when those attribute values change, the associated calculation script for this attribute will be triggered  by the system (at least that's what the articles claim).

In my case, my dependency is to another calculated value, and my script is getting triggered every time I save the work item, even though the dependent attribute value has not changed.

Does this dependency association only work with user-updated attributes?

The motivation for what I'm doing is to work around the problem that RTC scripts cannot determine whether a state change has occurred.  Therefore, I have created a hidden attribute to hold previous state, and I only want calculated attribute to fire when this previous state attribute changes (it also has a calculation script to update it from the new state).

Hope this make sense.  Any tips would be greatly appreciated!


0 votes


Accepted answer

Permanent link
According to the document https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Calculated_values :

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.
So what you observed is working as designed.
To meet your requirement, what I did is to create a hidden attribute to record the previous state. If the current state is different to the hidden previous state, the script will set a new value to the calculated attribute. Then the previous state will be updated to the same value as the current state.

Robert Huet selected this answer as the correct answer

2 votes

Comments

 Thanks, Lily,  I've noticed that the calculated value script runs on the client (browser or Eclipse) when the work item is created or when a dependent attribute is changed.  However, when the work item is saved, the script runs on the server (so can't use browser's debugger or console).  Is there any way to get the script to run on the client when the work item is saved in order to facilitate debugging?

For the server-side script, if you are using "console.log()", you can find the debug log from "<JazzTeamServer>/server/tomcat/work/Catalina/localhost/ccm/eclipse/workspace/.metadata/.log" if you use Tomcat. If you use WAS, it's "<WebSphere>/AppServer/profiles/<profileName>/temp/<node>/<server>/ccm_war/ccm.war/eclipse/workspace/.metadata/.log".

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
× 12,019

Question asked: Jul 21 '16, 4:57 p.m.

Question was seen: 2,327 times

Last updated: Jul 25 '16, 5:08 a.m.

Confirmation Cancel Confirm