It's all about the answers!

Ask a question

How to initialize the value everytime when loading a workitem ?


Tommy Wu (641) | asked Nov 13 '14, 12:46 p.m.
 I'm trying to init value (calculated script based) when loading workitem. but it will always be triggered when I save workitem. I plan to have a custom attribute which has the calculated script value (System date - Due Date). I would like it change everyday when I load (open) the workitem without modification. . but the value is always the same when day passed since I don't have any modification.  Any suggestion for doing this feature ? 

3 answers



permanent link
Eric Jodet (6.3k5111120) | answered Nov 14 '14, 7:07 a.m.
JAZZ DEVELOPER
 Hello Tommy,
I would use Default Provider - Script Based Default
Please refer to https://jazz.net/library/article/1003/

Hope it helps,
Eric

Comments
Tommy Wu commented Nov 14 '14, 7:29 a.m. | edited Nov 14 '14, 8:01 a.m.

 Hi Eric :

    Thanks for your response . I have tried Default value provider, but it only provide value when workitem is created.not everytime when I load the workitem. My requirement is to have a attribute which will be changed daily (system date), not only on creation time or save time, but on load (everytime when init workitem form value), any idea for that ?


Eric Jodet commented Nov 14 '14, 8:45 a.m.
JAZZ DEVELOPER

 As per Ralph's input,

there is not OOTB solution for that.


N Z commented Nov 16 '14, 5:38 p.m.

Hold on a minute. What type of alert do you want?


If you just want to see items past some date, then you can easily use the dashboard for that, no need for calculated values or anything like that.

Or are you after some other sort of notification? 


permanent link
Ralph Schoon (63.1k33645) | answered Nov 14 '14, 8:01 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
There is no mechanism that calculates the value of a work item just because it is loaded. The value providers work on
  • Creating a work item
  • Changing a dependent attribute
  • Clicking on an attribute

I quite don't get the use case either.


Comments
Tommy Wu commented Nov 14 '14, 8:41 a.m. | edited Nov 14 '14, 8:44 a.m.

Hi Ralph :

    Customer use case is that they want to add a attribute which is "system date -due date" , called alert indicator.
When alert indicator <=3 , then display red color nearby the filed. This is reminding their users to finish their task asap.  
   Any other ways to fulfill their requirement ?


Eric Jodet commented Nov 14 '14, 8:44 a.m.
JAZZ DEVELOPER

 Correct


Eric Jodet commented Nov 14 '14, 8:50 a.m.
JAZZ DEVELOPER

 Tommy,

sorry - for some reason - my last update was added to your comment.

I would use a js calculated attribute.
1 - overdue indicator attribute - overdue (3 values - green / orange / red)
2 - calculated value : due date - current date
  • if delta <1 day returns red
  • if delta <3 day returns orange
  • return green
Would this work?


Ralph Schoon commented Nov 14 '14, 8:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I moved the comment into a comment, that is why, probably.

I don't think this will work, because there is no triggering event that would change the calculated value. You also don't want that data always saved either.


permanent link
Ralph Schoon (63.1k33645) | answered Nov 14 '14, 8:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The only viable approach I am aware of would be a custom non attribute based presentation. See https://jazz.net/wiki/bin/view/Main/ContributingAttributePresentationsV2

Comments
Tommy Wu commented Nov 14 '14, 12:02 p.m. | edited Nov 14 '14, 12:05 p.m.

Hi Ralph :

   I just look through the link about the ContributingAttributePresentationsV2 , I found that the "star" presentation will display based on the attribute value(true/false)
star_enabled_and_disabled.png
But when will the "star" show up ? When Loading workitem ? or when you just save or editing the attribute value change?


sam detweiler commented Nov 16 '14, 8:13 p.m.

When loaded. But that IS the presentation of this attribute 


Ralph Schoon commented Nov 17 '14, 2:11 a.m. | edited Nov 17 '14, 2:11 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

My assumption is, you can add a presentation e.g. based on the due date and then, when it gets loaded and the UI displays the attribute, calculate its presentation based on the attribute and the current timestamp.

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.