How to initialize the value everytime when loading a workitem ?
![](http://jazz.net/_images/myphoto/93c3e4810dc3eb99931142c36574fda1.jpg)
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
![](http://jazz.net/_images/myphoto/93c3e4810dc3eb99931142c36574fda1.jpg)
Hello Tommy,
I would use Default Provider - Script Based Default
Please refer to https://jazz.net/library/article/1003/
Hope it helps,
Eric
Comments
![](http://jazz.net/_images/myphoto/93c3e4810dc3eb99931142c36574fda1.jpg)
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 ?
![](http://jazz.net/_images/myphoto/74cc5f0c959f8de0b1ece956a341150e.jpg)
As per Ralph's input,
there is not OOTB solution for that.
![](http://jazz.net/_images/myphoto/05be676674edc59ba0682f80ea6b01e0.jpg)
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?
![](http://jazz.net/_images/myphoto/93c3e4810dc3eb99931142c36574fda1.jpg)
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
![](http://jazz.net/_images/myphoto/93c3e4810dc3eb99931142c36574fda1.jpg)
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 ?
![](http://jazz.net/_images/myphoto/74cc5f0c959f8de0b1ece956a341150e.jpg)
Correct
![](http://jazz.net/_images/myphoto/74cc5f0c959f8de0b1ece956a341150e.jpg)
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
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
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.
![](http://jazz.net/_images/myphoto/93c3e4810dc3eb99931142c36574fda1.jpg)
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
![](http://jazz.net/_images/myphoto/93c3e4810dc3eb99931142c36574fda1.jpg)
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](https://jazz.net/wiki/pub/Main/ContributingAttributePresentationsV2/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?
![](http://jazz.net/_images/myphoto/d0f7b0b7bfc90721959d790b8a9bf79f.jpg)
When loaded. But that IS the presentation of this attribute
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
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.