It's all about the answers!

Ask a question

Default Value JS : set the category with the label


Antoine LELEU (5012728) | asked Jul 22 '13, 10:17 a.m.
 Hello,

I would like create a JavaScript Default Value to set the category according the TYPE of workitem.
 How can i set the field "Filed Against" without return the UUID but returning the label of the category ?

Thanks,

Antoine

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Jul 22 '13, 11:07 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please consider reading https://jazz.net/library/article/1093 Lab 5 (and lab 4 is also interesting).

To set filed against, you have to return the UUID. There is no way around it. If you want to set it in JavaScript you have to, because you have very few API and nothing that helps you to iterate the existing Categories, store the UUID to return in the process configuration.

You could follow http://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ and create a a default value provider. This gives you more access, includiung, I believe, access to all the categories as Objects, where you can look up the label and return the UUID for the one you want to pick.

Antoine LELEU selected this answer as the correct answer

Comments
Antoine LELEU commented Jul 22 '13, 12:12 p.m. | edited Jul 22 '13, 12:18 p.m.

 

Thanks you Ralph,

This is my problem :

I share the process configuration with several projects where the UUID of categories are differents. So i can't store the UUID in my script.

I searched a way to retun label of categories cause it is the same in all projects. Or find the UUID according the label directly in the JS.

Antoine  


Ralph Schoon commented Jul 22 '13, 12:22 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

As described in the workshop JavaScript does not provide an API to do what you want.
You can not iterate the existing categories, you can not search them. You ONLY have access to the work item's attributes and their values.

So JavaScript will not be able to help you with solving your problem. If you need what you describe you need to follow http://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ and use Java, becaue that has the API's you need. 

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.