It's all about the answers!

Ask a question

Dojo Scripting setting value for enumeration


sreenath v (7863) | asked Jun 26 '20, 4:53 a.m.
edited Jun 29 '20, 2:28 a.m.

dojo.provide("org.example.workitems.providers.SeverityTagValueSet12");

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("org.example.workitems.providers.SeverityTagValueSet12", null, {

    getValue: function(attributeId, workItem, configuration) {
    
        var tags= workItem.getValue(WorkItemAttributes.PRIORITY);
        var severityOptions= [];
        
        if (tags=="priority.literal.l02") {
            severityOptions.push("severity.literal.l4"); // Unclassified
            
        }
        
        
        

        return severityOptions;
    }
});
})();


I am trying to get when i select the Priority low automatically the severity should get set the value major.But it... is creating some java obeject@@26 enumeration value. any problem in script?

2 answers



permanent link
Ralph Schoon (63.1k33645) | answered Jun 29 '20, 2:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The script is for a value set - which would provide the available choices. It does not set any values. Only calculated values return one value that is then set.


Comments
sreenath v commented Jun 29 '20, 2:52 a.m. | edited Jun 29 '20, 3:08 a.m.
Ya i got it..I am using getValue. So can you please help me to set the value in same scenario or let me know how to.In links i can only see for age of workitem like maths calculation. How to set the value in enumeration automatically?

return "severity.literal.l4" will work

permanent link
Ralph Schoon (63.1k33645) | answered Jun 29 '20, 7:11 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jun 29 '20, 7:11 a.m.
This is an example of a calculated value provider:

/*******************************************************************************
 * 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.ValueProvider");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
    var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes; 

    dojo.declare("com.example.ValueProvider", null, {

        getValue: function(attribute, workItem, configuration) {
            var prio = workItem.getValue(WorkItemAttributes.PRIORITY); 
            if (prio == "priority.literal.l02") {
                return "severity.literal.l4"; // Unclassified
            }           
            return workItem.getValue(attribute);
        }
    });
})();


    

Your answer


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