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

Access value sets from Script Base Calculated Value

Hi,
i'm developing an extension that uses these objects:

1) a set a value sets with a set of specific values;
2) a Script Base calculated value

When the user select the value for the custom attributes that use value sets, the script base calculated value has been activated. This script should read all the possible value of a specific custom field and return that value.

The code of the script follow:

/*******************************************************************************
* 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("it.gvb.calculatedValue.readCompetenceCenterIdValues");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
    dojo.declare("it.gvb.calculatedValue.readCompetenceCenterIdValues", null, {

        getValue: function(attribute, workItem, configuration) {
       
        var result = "";
        var competenceCenterId = workItem.getValue("it.gvb.customattribute.competenceCenterId"); // here i should read ALL the values for the custom field that use a value set


var itApplicazioniInterne = "it.gvb.enumeration.competenceCenter.literal.l6";
var dataGovernanceUnit = "it.gvb.enumeration.competenceCenter.literal.l4";

if (competenceCenterId.toLowerCase() == itApplicazioniInterne.toLowerCase()) {
result = "IT-ApplicazioniInterne";
} else
  if (competenceCenterId.toLowerCase() == dataGovernanceUnit.toLowerCase()) {
  result = "DataGovernanceUnit";
  }

console.log("competenceCenterId: " + competenceCenterId);
console.log("result: " + result);

return result;

        }
    });
})();


Any idea? Could someone give more info of how read all values returned from the value set?
Thanks!

0 votes



One answer

Permanent link
As far as I know, you can only access the actual attribute values and not the set of potential values in a calculated value JavaScript. I don't know how you would be able to even find the value set provider for another attribute, if there is one.

There are many limitations in JavaScript attribute calculation, e.g. you can't access the roles of a user, you can't iterate the team area structure and the like. JavaScript is only good for basic customization.

0 votes

Comments

Hey Ralph,

Something other than this question.
From where did you get the "Timebox Planning Tool"?

Greetings

Guido showed it on an event we had with them and he invited me once they were able to share it.

I put links here:  https://rsjazz.wordpress.com/2015/04/13/some-community-extensions-for-rtc/

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
× 10,938

Question asked: Apr 17 '15, 6:30 a.m.

Question was seen: 2,854 times

Last updated: Apr 20 '15, 5:08 a.m.

Confirmation Cancel Confirm