It's all about the answers!

Ask a question

How to use javascript to add tag

Shmulik Tamari (1711015) | asked May 27 '14, 10:32 a.m.

I am trying to "save" Pland for history using Tags.

I am trying to add tag for every "Planed for" value using attribute customisation -> Script base Value set.

my script is:


(function() {
var WorkItemAttributes=;
var MyTags= [];

dojo.declare("org.orbotech.CopyPlanForToTag", null, {

    getValue: function(attributeId, workItem, configuration) {
  return MyTags;


I set the Tag to use the script & add Planed for as dependencies.

I dont get any value in the Tag.

can I set the Tag this way?

is there another way do add tag?

thank you 

One answer

permanent link
Donald Nong (14.5k314) | answered Jun 06 '14, 5:31 a.m.
I have not been able to implement what you want to do but have found a few things that you need to take care of.
1. The "Tags" attribute appears to be expecting a "collection", not an "array". I found it out in the error message that I got.
2. workItem.getValue(WorkItemAttributes.PLANNED_FOR) returns the internal Id, not the label such as "Release 1.0".
3. Tags only allow a single word, and the enumeration label needs to be converted before passing on as a tag.

Ralph Schoon commented Jun 10 '14, 4:33 a.m.

The JavaScript API provides workItem.getValue() (provides the ID of the item for more complex items) and workItem.getLabel() which describes the display value.

Shmulik Tamari commented Jul 07 '14, 11:12 a.m.

thank you for your answers.

since it become more complicated then I thought, I use the SDK to solved it. 

Jonas Studer commented Jul 08 '14, 5:02 a.m.

Am I right, you wanted to change a Workitem State e.g. from "new" to "Planned for" or did you just wanna set a tag?

Your answer

Register or to post your answer.