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

script-based customization getValue returns null (Newbie question)

 Can't seem to use getValue() or WorkItemAttributes. How do I get these loaded? Is there a configuration someplace to point to these resources?

*****************************************************************************************
This first one works:
******************************************************************************************
dojo.provide("com.example.ValueProvider.basedonstate");

dojo.require("dojo.date");
dojo.require("dojo.date.stamp");

(function() {
    dojo.declare("com.example.ValueProvider.basedonstate", null, {

        getValue: function(attributeId, workItem, configuration) {
          var currentDate= new Date();
          var Datestring= dojo.date.stamp.toISOString(currentDate, {milliseconds:true, zulu:true});   
          return "Date " + Datestring ;
        }

    });
})();

*********************************************************************************************
This Does not:
*********************************************************************************************
dojo.provide("com.example.ValueProvider.basedonstate");

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");

(function() {
    dojo.declare("com.example.ValueProvider.basedonstate", null, {

        getValue: function(attributeId, workItem, configuration) {
        var typeString =   + workItem.getValue(WorkItemAttributes.TYPE);    
        return "Type: " + typeString ;
    }
    });
})();

0 votes



2 answers

Permanent link
here is one of my condition scripts

<code>
dojo.provide("com.xx.defect.resolution.Condition");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
    dojo.declare("com.xx.defect.resolution.Condition", null, {

        matches: function(workItem, configuration)
        {
           var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
           var rc = false;
           var workitemtype = workItem.getValue(WorkItemAttributes.TYPE);

           console.log(workitemtype);

           if( workitemtype ==="defect" )
           { 
              var state= workItem.getValue(WorkItemAttributes.STATE);
              console.log(state);

              if(state === "3" )
              {
                 var resolution = workItem.getValue(WorkItemAttributes.RESOLUTION);
                 console.log(resolution);
                 if(resolution === "3" )
                 {
                   var classification = workItem.getValue("com.xx.fribblelist");
                        console.log(typeof(classification))
                    if(classification === "" )
                    {
                        /*return (state === "3" || state === "4"); // Resolved or Verified stat
                        rc= true;
                    }
                    rc = true;
                 }
              }
           }
           return rc;
        }
    });
})();
</code>

0 votes

Comments

I don’t seem to be able access getValue or WorkItemAttributes. I suspect there is someplace where the paths to these js files needs to be set but: 

1. I don’t know where and;
2.    I don’t know if I have the access (jazzProgAdmin).


Permanent link
needed the line: 

var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes ;

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

Question asked: Jun 03 '13, 10:55 a.m.

Question was seen: 3,235 times

Last updated: Jun 03 '13, 1:02 p.m.

Confirmation Cancel Confirm