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

Help with Script Create - Set the Value for Enumerations

 Hi,

I need some help to create a script which will populate an Enumeration when a work item is created:

So I have an Enumeration:  Enum1
Values:  1 Initial;  2 Study

I have then created two Attributes in the work items:
Milestone1
Milestone2

What I would like is to automatically set:
  • Milestone1 Enumeration to "1 Initial"
  • Milestone2 Enumeration to "2 Study"
 So I need a script which populates these Enumeration values.
Any help would be great.

Thanks

0 votes



One answer

Permanent link
Please see https://jazz.net/library/article/1093 lab 5. You need to create two default value provider scripts and return the enumeration literal ID's.

0 votes

Comments

 Hi is it not possible to have one script that defines all Variables:


If possible could you provide an example?

A value provider can only provide the value to one attribute. You can use the same provider for several ones if the type matches.

Here is example code - consider to read the workshop.

/***********
 * 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.ibm.js.rtc.wi.provider.default.Skeleton");

(function() { dojo.declare("com.ibm.js.rtc.wi.provider.default.Skeleton", null, {

getDefaultValue: function(attribute, workItem, configuration) {

    //var value = //... //Some code that computes a return value
    //return value;
    return "priority.literal.l3" // Medium priority
}

}); })();

 I've found this script as I'm new and do not understand scripting: how can this be expanded for all mappings?

dojo.provide("com.example.DefaultValueProvider");

(function() { dojo.declare("com.example.DefaultValueProvider", null, {

    getDefaultValue: function(attribute, workItem, configuration) {

        return "Risk.literal.l3"

    }
});

})();

Start here: https://jazz.net/wiki/bin/view/Main/AttributeCustomization and https://jazz.net/library/article/1093 lab 5

You can only deal with one enumeration at a time.
If you use the same enumeration for all attributes, you could use the attribute ID 'attribute' from the call.
e.g. if(attribute="id.of.attrib1") ....

Hi,

I'm using the same enumeration;  so how would you add the script for that?
sorry to ask simple question - but can you provide an example in the script above

If you would just care to look at the workshop and the other link I proposed you to read, all your questions would be answered, I think.

showing 5 of 6 show 1 more comments

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

Question asked: Jul 15 '14, 7:03 a.m.

Question was seen: 3,830 times

Last updated: Jul 22 '14, 2:19 a.m.

Confirmation Cancel Confirm