It's all about the answers!

Ask a question

Problem triggering Script depending on TIME SPENT attribute change


Alejandro Gay (1158) | asked Jun 12 '14, 10:29 a.m.
edited Jun 13 '14, 2:28 a.m. by Ralph Schoon (57.5k23642)
I made a couple of scripts to be run when ESTIMATE, CORRECTED ESTIMATE or TIME SPENT attributes changes, the idea is that the scripts will calculate two custom attributes for the Hours Remaining and the Progress based on those attributes.
So in these attributes (Hours Remaining, and Progress) I've defined dependencies on ESTIMATE, CORRECTED ESTIMATE and TIME SPENT, and of course they have the corresponding script as Calculated Value.
For changes on the ESTIMATE and CORRECTED ESTIMATE attributes, the scripts are triggered with no problem, but for TIME SPENT it doesn't, what I'm guessing is that  scripts are executed only when you change manually a field, not when is done automatically like by saving the hours in the time tracking tab which updates the TIME SPENT attribute in the main tab.
Is there a way to do this?




Comments
Ralph Schoon commented Jun 13 '14, 2:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am pretty sure I did something like that in the past and it worked for me. If the attribute changes, the script should trigger, provided you have the dependency to the attribute. It should not matter who changes the attribute.

One answer



permanent link
Eric Jodet (6.3k5106120) | answered Jun 13 '14, 6:40 a.m.
JAZZ DEVELOPER
 Hello Alejandro,
I just tested in my debug env - Change and Configuration Management - Core Libraries, Version 5.0.1 M2 (X20140613-1216)

- created a FPM PA
- created a calculated value provider, with example code and a console.log("someString");
- created an integer attribute, using this provider, depends on Time Spent attribute
- create a work item and update Time Sheet entries (which updates the Time Spent attribute value)

observed: the log shows 
!ENTRY com.ibm.team.rtc.common.scriptengine 1 0 2014-06-13 12:34:38.816
!MESSAGE LOG: 'someString'

--> the script gets called

Did you add some console.log to your js file?

Your answer


Register or to post your answer.