It's all about the answers!

Ask a question

RTC - The Value set is not activate .


Olga M (827) | asked Aug 20 '15, 10:32 a.m.
Hello
I  am  trying  to activate  the  Value  set  on  deliverable  field   .
The  value  set is  not  activated ,  I  do not  get error  , it  just  is  not  working.
I have tried to  set  the example  value  set  to  Small String  field and  it  is  not  working  also  . 


My  script  is  :
dojo.provide("SetDeliverableField");
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("SetDeliverableField", null, {

    getValueSet: function(attributeId, workItem, configuration) {
        var result= [];
       

        var csci= workItem.getValue(WorkItemAttributes.FILED_AGAINST);
        console.log(release);
       
     
       
           var found= false;
    
        var allReleases= configuration.getChildren("release");
        for (var i= 0; i < allReleases.length; i++){
            var r= allReleases[i];
             var releaseName= r.getString("uuid")
            if (releaseName.indexOf(csci)>-1) {
                // If there is a configuration entry for this release use it
                found= true;
                result.push(releaseName)
                }
            }
        }
       
     
        if (!found) {
            for (var i= 0; i < allReleases.length; i++){
            var r= allReleases[i];
             var releaseName= r.getString("uuid")
            result.push(releaseName)
              }
        }
       
        return result;
    }

Please advice  ...
Thanks  in advance.

Comments
Don Yang commented Aug 20 '15, 7:27 p.m.

Have you set the property Enable Process Attachment Scripts to true(https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript)? Did you see any info in ccm.log file as you have
console.log(release);in the script? you may want to insert more console.log() to the script and see what are returned during runing.

One answer



permanent link
Donald Nong (14.4k314) | answered Aug 21 '15, 2:04 a.m.
Debug your code carefully as there are many errors in your code. If you check the ccm.log file (the script is executed on the server side), you should see errors there, and you will see any error in the browser. Here are some obvious errors that I can see in your code.
1. The variable "release" is never defined.
2. The last "if" block is outside of the "getValueSet: function" block. (How did you manage to do that?)
3. Some lines of code are missing the ending semicolon(;).
4. The entire script is not properly terminated (if you have posted the code completely).

Comments
Olga M commented Aug 27 '15, 2:07 a.m.

Hi  Donald

I  will  check  the  code  and  the  errors  by  your  suggestion  . 

A  lot  of  thanks  for  your  help  !

Your answer


Register or to post your answer.