Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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.

0 votes



2 answers

Permanent link

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

0 votes

Comments
  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
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?

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,031
× 42
× 34

Question asked: Apr 07 '15, 7:52 a.m.

Question was seen: 4,125 times

Last updated: May 07 '15, 8:00 p.m.

Confirmation Cancel Confirm