It's all about the answers!

Ask a question

How to incorporate the default values for a description field using dojo script for a particular Work Item


vineeth vp (637) | asked Apr 07 '15, 7:52 a.m.
How to incorporate the default values for a description field using dojo script for a particular Work Item (like only for a story etc.,)
Description field should auto populate only when Work Item = "Story" and not for others using dojo.

2 answers



permanent link
Dinesh Kumar B (4.1k413) | answered Apr 07 '15, 8:58 a.m.
JAZZ DEVELOPER
edited Apr 07 '15, 9:00 a.m.

You will have to use a Script Based Default Value applied to the Description attribute.

Some sample code for you to set Default Description for Defect work item would be  :

dojo.provide("com.example.defDefectDescription");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
    dojo.declare("com.example.defDefectDescription", null, {

        getDefaultValue: function(attribute, workItem, configuration) {

var defectDesc = null;

if(workItem.getValue(WorkItemAttributes.TYPE) === "defect")
// for a story from Scrum project the ID to compare against would be : com.ibm.team.apt.workItemType.story
defectDesc = "this is for defect only";

return defectDesc;

        }
    });
})();


The key here is to look for the ID of the Work Item Type and return the values accordingly.

You may additionally want to read more on this here :
    https://jazz.net/forum/questions/98267/how-to-set-different-default-owners-for-different-workitem-types

Comments
vineeth vp commented Apr 08 '15, 1:42 a.m.
  1. Can you let me know where to incorporate this piece of code in "attribute customisation" field. Should this be added as "Default Value" ? or as "Validator" ? or as a condition ?? Do throw some light on the same by providing the next steps.

  2. Also do tell me whether any modifications have to be done at the .xml level as well (if its applicable to incorporate this idea)
     

permanent link
Uma venkata Lekkala (52519) | answered May 07 '15, 8:00 p.m.
We need to update couple of fields based on the selection of Restricted Access (Access Groups) field or limit the options available under Restricted access based on the selection of two fields. because we have 70 Access group combos to restrict access between customer and internal department.

Problem is I do not see Restricted Access field either in the source or destination fields of the Value Sets of type Dependent Enumerations.

Is there a Followup action script or something that can achieve this?

Your answer


Register or to post your answer.