Set a tag using Calculated Values script
![](http://jazz.net/_images/myphoto/58290026204d75054166d41a4e774a68.jpg)
// IWorkItem workItem = workingCopy.getWorkItem();
List<string style="box-sizing: border-box;"> tags = workItem.getTags2(); tags.add("NewTag"); workItem.setTags2(tags);</string><string style="box-sizing: border-box; font-size: 13px;">
</string>
</string>
</string>
<string style="box-sizing: border-box; font-size: 13px;">Gil</string>
Accepted answer
![](http://jazz.net/_images/myphoto/58290026204d75054166d41a4e774a68.jpg)
For all I can tell you can not set a tag using JavaScript attribute customization.
You would need to use a Java based attribute customization or a server side extension.
Note that default values are pretty much useless for your purpose, because the default value for a specific type is useless as you can change the type later and the default will not.
One other answer
![](http://jazz.net/_images/myphoto/58290026204d75054166d41a4e774a68.jpg)
The code you refer to is code for the Plain Java Client Libraries and not for the JavaScript API. This is the information for attribute customization: https://jazz.net/wiki/bin/view/Main/AttributeCustomization you basically have setValue() and that is it.
I have not tried, but the tag attributes expect a list of strings.
Comments
![](http://jazz.net/_images/myphoto/58290026204d75054166d41a4e774a68.jpg)
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
Sorry, I can't. Not sure how that should work. For API examples read https://jazz.net/wiki/bin/view/Main/AttributeCustomization
For some additional examples read
Last lab.
You could try to set a string as value and use a comma e.g. "tag1,tag2" or "tag1 tag2".
That is all I can do. I have no time to experiment.
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
https://www.google.com/search?q=java+script+set+tag+site%3Ajazz.net suggests that this might not be supported.
![](http://jazz.net/_images/myphoto/58290026204d75054166d41a4e774a68.jpg)
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
I doubt you can even detect a work item is moved (versus just created) in the JavaScript Attribute customization.
It might be possible to detect that in a follow up action.
![](http://jazz.net/_images/myphoto/58290026204d75054166d41a4e774a68.jpg)
My thought was to set a tag to the work-item before the move and detect it by the tag after the move. The work-item is created in the original Project Area as a child work-item and with a unique type so I wanted every such work item type to have a mark, tag in this case. Is there a way to set a default tag to a specific work-item type (e.g. task) either from script or from Default Values?