need to control required fields differently based on the resolution code
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. <code> /******************************************************************************* * 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.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) { // get access to the attribute definitions var WorkItemAttributes = com.ibm.team.workitem.api.common.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); //console.log(state); if(state === "3" ) // numeric of Sx workitem state { var resolution = workItem.getValue(WorkItemAttributes.RESOLUTION); //console.log(resolution); if(resolution === "3" ) /* || resolution === "4"); //the numeric of the rx resolution code */ { // this means error rc = true; } } } return rc; } }); })(); </code> |
Be the first one to answer this question!
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.