How to incorporate the default values for a description field using dojo script for a particular Work Item
![](http://jazz.net/_images/myphoto/99b4c05952b9957b93a6f1dba6f5d1e1.jpg)
2 answers
![](http://jazz.net/_images/myphoto/99b4c05952b9957b93a6f1dba6f5d1e1.jpg)
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
![](http://jazz.net/_images/myphoto/99b4c05952b9957b93a6f1dba6f5d1e1.jpg)
- 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.
- Also do tell me whether any modifications have to be done at the .xml level as well (if its applicable to incorporate this idea)
![](http://jazz.net/_images/myphoto/99b4c05952b9957b93a6f1dba6f5d1e1.jpg)
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?