Jazz Register Log in
Jazz Forum Welcome to the Jazz Community Forum

Welcome to the Jazz Community Forum

Connect and collaborate with IBM Engineering experts and users

error on tags attribute customization

I am trying to create an attribute customization on the tags  field, in order to add additional tags.
the tag field seem to accept only a collection type, but when I read the value it returns a common string (values separated by comma)

the following code simply reads the value of the Tags attribute and try to set the same value, the other example I tried are commented - I tried to return an array and a javascript object/ collection. none of the options worked, I always get the following error:

Error: java.lang.String incompatible with java.util.Collection | Details: java.lang.String incompatible with java.util.Collection

(this error appears even when I return an object or array)
I would like to know what is the valid format that this attribute expects to receive, there is no place in the documentation talking about this format.

I removed the source code because the question was being flagged as spam!!!

0 votes

Comments
dojo.provide("util.RTCPlayArea.TestValue");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.string");

(function() {
    var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
    dojo.declare("util.RTCPlayArea.TestValue", null, {

        getValue: function(attribute, workItem, configuration) {
            console.log(attribute);
            // return [test", "test2"] 
            // return {"0":"test","1":"test2"}
            return workItem.getValue(attribute); //get Value returns a string

        }
    });
})();

I know this isn't guaranteed to work.
https://jazz.net/forum/questions/102338/how-to-do-attribute-customization-to-clear-description-field

I'll test this out and see if I can figure out. Have you tried return {{val1|val2}}; type syntax? This can be used to return values in HTML type fields.

I don't think this is critical, but I recommend obtaining the value of the Tags attribute using the built-in WorkItemAttributes.TAGS.



2 answers

Permanent link

I was easily able to reproduce the behavior you describe. The {{ }} syntax didn't seem to work. I am afraid I can't find a solution to this using Javascript. I think you could do this without too much problem using a Java based attribute customization, where it is easy to control what type is returned. Let me know if you are interested to know more about how to do that. You can find some useful tips in the bottom of the wiki page and in pages created by Ralph Schoon:

https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Providing_new_customizations_imp

https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/

0 votes


Permanent link

I will post here Ian's Wark comment so it can be considered the final answer:

"I was easily able to reproduce the behavior you describe. The {{ }} syntax didn't seem to work. I am afraid I can't find a solution to this using Javascript. I think you could do this without too much problem using a Java based attribute customization, where it is easy to control what type is returned. Let me know if you are interested to know more about how to do that. You can find some useful tips in the bottom of the wiki page and in pages created by Ralph Schoon:

https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Providing_new_customizations_imp

https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/
"



Javascript customization have its limitations, which include handling complex type attributes - so it is not possible to assign new tags using javascript customization

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 6,141

Question asked: May 02 '18, 4:34 p.m.

Question was seen: 2,744 times

Last updated: May 07 '18, 9:41 p.m.

Confirmation Cancel Confirm