Is it possible to define a default text for description of workitem type Defect?
Hallo!
I saw that JAZZ.net is using a default text in the description field dependent on the worktiem type. For example, if I crete a defect, the description is prefilled with "What steps will reproduce the problem? 1. 2. 3. ..." A different description is shown, if a create a new Maintenace Item. "Maintenance Item Guidelines 1. How to use this work item: ..." (Link to it) I tried to configure this in our RTC, but the default text was set to all workitem types. How can I configure it as it is in JAZZ.net? Thanks! Christian |
Accepted answer
Instead of using the script-base default value, you can also create multi-line text default values and map them to each work item type. See https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Default_values. This requires more default values to be created and maintained, but it's another option to consider.
I also attach a sample script below. The script assumes the ID of defect work item type to be 'defect'. The script is based on the skeleton provided in the 'Script-based default value' section in the jazz.net wiki link that Dinesh posted above. To create a script-based default value and use it, see https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Using_scripts_for_attribute_cust //========== SAMPLE SCRIPT-BASE DEFAULT VALUE ========== dojo.provide("com.example.common.MyClass"); dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); (function() { var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes; dojo.declare("com.example.common.MyClass", null, { getDefaultValue: function(attribute, workItem, configuration) { var WorkItemType= workItem.getValue(WorkItemAttributes.TYPE); var DEFECT_DESC= "Defect Description Line 1\n\ Defect Description Line 2" var OTHER_DESC= "Other Description Line 1\n\ Other Description Line 2" if (WorkItemType == "defect") { return DEFECT_DESC; } return OTHER_DESC; } }); })(); Christian Winkler selected this answer as the correct answer
Comments
Christian Winkler
commented Nov 14 '14, 8:43 a.m.
Thanks Kot!
That could be because Description is a built-in attribute, which is shared across multiple work item types in the project area. Per the note in the attribute's editor, modifying a built-in attribute will affect all WI types in the project.
Christian Winkler
commented Nov 19 '14, 3:21 a.m.
Hello Kot!
|
One other answer
have you explore the "Script Based Default Value" which seems more appropriate to me...
in the script, you could check for the workitem's TYPE (workItem.getValue(WorkItemAttributes.TYPE);) and return a different value accordingly. more on script based default could be found here : https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Script_based_default_values hope it helps. Comments
Christian Winkler
commented Nov 13 '14, 10:38 a.m.
Hello Dinesh,
|
Your answer
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.