It's all about the answers!

Ask a question

need to control required fields differently based on the resolution code

sam detweiler (12.5k6185201) | asked Feb 25 '13, 7:06 p.m.
edited Feb 25 '13, 11:22 p.m.
I thought I saw a discussion of this problem,
we want to make a field required on resolution, but only for a subset of the resolution codes.

I know this doesn't come out of the box.

I am wondering if I can do it in javascript (then I wouldn't have to reboot the server)

I have a multi-select checkbox presentation, which stores values in a string..

so, if going to Resolved state
         and if the proposed resolution code is  'fixed' or 'fixed upstream' or ....
            then if the classification field is empty.
               error 'Classification must be selected'

ssooooo,, here it is  but it only works on 4.x
Required Attributes for Condition Precondition.

 * 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.

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

        matches: function(workItem, configuration)
           // get access to the attribute definitions
           var WorkItemAttributes =;
           // default return, means no error
           var rc = false;
           // get the workitem type, maybe not needed as this is attached to a specific
           // field in a specific workitem.
           var workitemtype = workItem.getValue(WorkItemAttributes.TYPE);
           // log for debugging
           // in workspace/.metadata/.log
           // console.log(workitemtype);

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


              if(state === "3" )    // numeric of Sx workitem state
                 var resolution = workItem.getValue(WorkItemAttributes.RESOLUTION);
                 if(resolution === "3" )  /* || resolution === "4"); //the numeric of the rx resolution code */
                      // this means error
                      rc = true;                     
           return rc;



Be the first one to answer this question!

Register or to post your answer.