Default Value JS : set the category with the label
Accepted answer
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.
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.
Comments
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
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.