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

how to edit of WI updates condition

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.

0 votes

Comments

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
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

0 votes


2 other answers

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


0 votes

Comments

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.

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


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

0 votes

Comments

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")

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.

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
× 6,125

Question asked: Dec 10 '12, 1:35 a.m.

Question was seen: 5,000 times

Last updated: Dec 10 '12, 5:33 a.m.

Confirmation Cancel Confirm