It's all about the answers!

Ask a question

How to set an attribute based on the time WI is loaded?


Luiz Almeida (23015489) | asked Nov 22 '17, 3:16 p.m.
edited Nov 22 '17, 3:18 p.m.

Hi guys,


I created an attribute and I would like to fullfill it with the time that workitem is loaded using "Script Based Vale Set". Does anybody knows if is it possible?

When we open, update or refresh the workitem, the information of the time that the WI is loaded appears in the page as presented below:

Can I use this information in my script? Maybe some internal field can return this information....any ideas?

Since now, thanks for any tip.

Luiz Cesar.

Accepted answer


permanent link
Geoffrey Clemm (30.1k33035) | answered Nov 22 '17, 4:19 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I believe you are thinking of a "script-based calculated value", not a "script-based value set.  But that doesn't help, because changes to the calculated value are triggered by a save of the work item, not by a "load" of the work item (I assume by "load", you mean when the work item is retrieved from the server via a GET call).

And you shouldn't try to do this anyway, because that would result in a write to the database for ever work item that is read from the server, which would flood the database with write transactions.
What is the use case you are trying to address?   Perhaps there is a more reasonable way of achieving it.

Luiz Almeida selected this answer as the correct answer

Comments
Luiz Almeida commented Dec 18 '17, 2:45 p.m.

Geoffrey,

Sorry for the late, but what I was trying to do was to show the time a workitem was in a status. I've created an attribute that records the time the workitem has the status changed. So, If there was a way to figure out the time when the workitem was loaded, I could calculate "time_workitem_loaded" minus "time_status_changed", then I would have the time the workitem is in the status.
Did you understand me?

One other answer



permanent link
Ralph Schoon (63.1k33645) | answered Dec 18 '17, 3:13 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Dec 18 '17, 3:16 p.m.

Did you even read the answer? An attribute customization using what the basic JavaScript attribute customization allows will NOT work.
Here is an approach that works for the Web UI, dependent on the requirements: Custom RTC work item presentation showing the state history.


Comments
Guido Schneider commented Dec 18 '17, 4:35 p.m.

BTW, this should also be possible with Report Builder, if you like to have a report showing how long a Work Item was in a particular state.


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.