It's all about the answers!

Ask a question

how to edit of WI updates condition


Ayan Paul (2552230) | asked Dec 10 '12, 1:35 a.m.
I have configured a Script-based calculated value.
my script is taking 'actual start time' where status changes to 'in progress'.
But in WI, whenever a save happened, its updating 'actual start time'.

Can you tell me how to edit of WI updates condition.

Comments
Ralph Schoon commented Dec 10 '12, 2:40 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

As far as I can tell, there is no way to tell a state change in a script today. If your script has only the dependency to the state attribute, you might be able to use that because it will trigger on saving the state. If a state change needs to be detected, I usually use an Advisor or Participant.

Accepted answer


permanent link
Dinesh Kumar B (4.1k413) | answered Dec 10 '12, 5:33 a.m.
JAZZ DEVELOPER
even if you get it to record the time only on a state change (this is currently not possible as a save will invoke the script forcing it to return some value and hence inducing a changed attribute value), if the worflow allows a reopen (and possible revisit of the same state), the condition will be true again and a possible second assignment of the attribute value...
Ayan Paul selected this answer as the correct answer

2 other answers



permanent link
Ralph Schoon (63.1k33645) | answered Dec 10 '12, 3:33 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Then this is not doable with JavaScript. JavaScript has no mechanism to detect the state change as far as I can tell.

You need to create an Advisor or Participant.
See https://jazz.net/library/article/1000 or the other versions for your version of RTC and check https://rsjazz.wordpress.com/ for some other examples.

Comments
Ayan Paul commented Dec 10 '12, 4:12 a.m.

it is possible. see the example, I m identifying state and type and accordingly taking the date.
(type == "issue" && state =="com.ibm.team.workitem.issueWorkflow.state.s7")


Ralph Schoon commented Dec 10 '12, 4:32 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Great if it works for you.

My concern is the script will trigger if the state changes as well as if the type changes or any other dependent attributes you might have. It might even trigger multiple times if multiple changes occur. You can not tell what the value of the attributes were before, so it is hard to tell that the state changed. However, great if it works for your special case.


permanent link
Dinesh Kumar B (4.1k413) | answered Dec 10 '12, 2:28 a.m.
JAZZ DEVELOPER
Hi Ayan,

Any save operation will trigger the execution of scripts. 

Below is an extract from Attribute Customization Wiki which states the three conditions where a script gets executed:

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.
hence the behavior you are experiencing appears to me to be expected.



Comments
Ayan Paul commented Dec 10 '12, 2:38 a.m.

but in that case, we wont get the proper actual start date as it is getting modified
How can it be rectified? I want only at the time of status changes to 'in progress', it will take actual start date.


Ayan Paul commented Dec 10 '12, 3:14 a.m.

I have the dependency on WI Type and WI Status. Please let me know how I can rectify this issue. Thanks in advance


Your answer


Register or 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.