Configuring script-based value sets

You can use a script to set the values of a value set. The script can .use values of other attributes or independent data attributes, such as time, to set the values of the value set.

About this task

This task uses the Script Based Value Set provider to provide values for a string (Small String, Medium String, Large String) or String List type attribute. If a script-based value set depends on other attributes, the script uses the values of the attributes from the last time the work item was saved. The one exception to this is in the Eclipse client when one of the attributes is a String List type, in which case the script is not executed until the user selects a value for that attribute.

Procedure

  1. Open the Attribute Customization page:
    1. In the Team Artifacts view of the Work Items perspective, right-click the project area and select Open.
    2. Click the Process Configuration tab.
    3. Expand Project Configuration > Configuration Data > Work Items, and then click Attribute Customization.
  2. Select Value Sets, then click Add. Enter a name that describes the customization. Select Script Based Value Set from the Provider drop-down list. Click OK.
    Screen capture of Add Configuration window with Script Based Value Set selected in the Provider field.
  3. Enter the script in the Script field. Alternatively, click Load to select a file that contains the script code.
    For example, the following is a very simple value set script:
    dojo.provide("com.example.StringValueSetProvider");
    
    (function() {
        dojo.declare("com.example.StringValueSetProvider", null, {
    
            getValueSet: function(attributeId, workItem, configuration) {
    	        return ["this", "value", "set", "is", "coming", "from", "a", "script", "!!!"];            
            }
       });
    })();
    Note: The Configuration section of the user interface lets you select the Filtered checkbox to filter the values in the value set. If you select Filtered, specify the getFilteredValueSet method, rather than the getValueSet method in the script.
  4. Click Attributes and Types. Select the work item type, such as Defect or Task. Scroll to the Attributes section. Click Add. Create a custom attribute for the value set. In the Type field, select a string (Small String, Medium String, Large String) or String List type. In the Value Set field, select the Script Based Value Set that you previously created. Click OK to save the new attribute. For example:
    Screen capture of Add Custom Attribute window
  5. Click Editor Presentations. Select the editor presentation to which you want to add the field for the new attribute. Select the tab and then section to which you want to add the field. For example, the Details section on the Overview tab. With the section selected, click Add Presentation to add a field for the new attribute.
  6. Click Save to save your changes to the project area.

video icon Video

Jazz.net channel
Software Education channel

learn icon Courses

IoT Academy
Skills Gateway

ask icon Community

Jazz.net
Jazz.net forums
Jazz.net library

support icon Support

IBM Support Community
Deployment wiki