It's all about the answers!

Ask a question

Script based default value for integer


Ilona Krammer (159223) | asked Dec 14 '16, 7:20 a.m.
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.

Comments
Miguel Tomico commented Dec 14 '16, 7:48 a.m.

Ilona Krammer commented 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?

One answer



permanent link
Ralph Schoon (59.7k23643) | answered Dec 14 '16, 8:11 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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
Ilona Krammer commented Dec 14 '16, 8:19 a.m.

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


Ralph Schoon commented Dec 14 '16, 8:32 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.

Your answer


Register or to post your answer.