Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Blanking StringList attributes

Hi all,
is there anybody out there than can help me on how to blank out a string list attribute based on the change of the "filed against" attribute ?

I had to use the string list (associated to a HTTP Filtered Value Set) because  there is not the possibility to manage a dependent enumeration value set for enumeration list attributes. My set of values depends upon the Work item category, and when I change this attribute I need to clean up my string list attribute because it usually contains incoherent values if populated with a different work item category.

My solution should be to clean out the string list on the change of the category, and I would like to do it at client level, with any type of attribute customization, but I dont know how to do it. I tried with multi line text and javascript providers with no results: would you please help me ?

Thanks,
kind regards
andrea

0 votes


Accepted answer

Permanent link
Hi Andrea,

I tried JavaScript and it does not work. This script should do it:
/*******************************************************************************
 * Licensed Materials - Property of IBM
 * (c) Copyright IBM Corporation 2011. All Rights Reserved.
 *
 * Note to U.S. Government Users Restricted Rights:  
 * Use, duplication or disclosure restricted by GSA ADP Schedule 
 * Contract with IBM Corp. 
 *******************************************************************************/
dojo.provide("com.example.CleanListValueProvider");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

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

        getValue: function(attribute, workItem, configuration) {
            //var category = workItem.getValue(WorkItemAttributes.FILED_AGAINST);
            var category = workItem.getLabel(WorkItemAttributes.FILED_AGAINST);
            console.log("Category: " + category);
            if (category=="Core"){
            	 //var result= [];	
            	 var result= null;	
			     return result;
			}
			// var result= null; // Works but not desired
			return workItem.getValue(attribute); // java.lang.String incompatible with java.util.Collection
        }
    });
})();

Unfortunately it does not.  I can basically not even return the original value of the attribute (to not change the value in case it is not supposed to be). I think List attributes are currently at least not supported in JavaScript based calculated values. They work only for value sets. Feel free to file a defect or enhancement request.

I can only return null to clear the values, but since I always have to return a value, that means it will always clear the attribute if the category changes. Not very helpful.

you could try to follow https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ and create a calculated value in Java. In this case you can return a List or Collection of string values, which should work.

Andrea Perniciano selected this answer as the correct answer

1 vote

Comments

Hi Ralph,
I actually tried something like that, and I agree there are some more work to do with the xList attribute types to enhance their usability.

I'll try to work on a java attribute validation

Thank you

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
× 12,019

Question asked: Oct 09 '14, 2:51 a.m.

Question was seen: 2,634 times

Last updated: Oct 09 '14, 7:37 a.m.

Confirmation Cancel Confirm