Script based default value for integer
So I thought I was trying something simple but somewhere I obviously went wrong.
What I want is set an attribute to a default value (tried any number but want work item ID actually)
- I created a script based default value and used the example, only changing the return value to an actual number during my tests
- switched to "types and attributes" and set the default value to the script based value
saved and tried and - nothing! it simply doesn't react! When trying to debug it, it doesn't even seem to use the default value at all.
the process configuration says I have the value provider set so I'm really not even sure where to start to look why this doesn't work. If I use a simple number default value everything works fine.
What I want is set an attribute to a default value (tried any number but want work item ID actually)
- I created a script based default value and used the example, only changing the return value to an actual number during my tests
- switched to "types and attributes" and set the default value to the script based value
saved and tried and - nothing! it simply doesn't react! When trying to debug it, it doesn't even seem to use the default value at all.
the process configuration says I have the value provider set so I'm really not even sure where to start to look why this doesn't work. If I use a simple number default value everything works fine.
One answer
You can not set the work item ID. That is basically a key and generated by the system. See this project for a potential solution to generate unique custom numbers that can be set in a custom attribute: Extension to generate unique custom work item numbers
Comments
I don't want to set the work item ID - I want to use it as a unique number (which in some cases has to be changed, that's why it needs to be first duplicated into another attribute field and can then be adapted by the user if he needs to)
I guess I'm going to write a java extension to do that
It would have to be a participant as far as I can tell, because the ID will only be available during the save. Default value provider are only of very limited use, as they lack a lot of information when called.
Comments
Miguel Tomico
Dec 14 '16, 7:48 a.m.Please have a look at this similar question:
https://jazz.net/forum/questions/232064/calculated-value-script-not-returning-the-value
Ilona Krammer
Dec 14 '16, 8:16 a.m.Read and tried those things but nothing worked unfortunately..
But then again for the moment I need to insert the work item ID which is not available until the item is saved so I'm guessing I don't really have a chance at solving that with a default value anyway - right?