Can we have populated text of an attribute based on some other value?
Shuchita Tripathi (314●3●65●95)
| asked Feb 03 '17, 8:43 a.m.
edited Feb 06 '17, 7:47 a.m. by Ralph Schoon (63.5k●3●36●46) Hi,
Can we populate some text in Description field based on the value of an enumeration? For every value of enumeration, the text has to be different.
I tried Default Value and Value Sets from https://jazz.net/wiki/bin/view/Main/AttributeCustomization but I am not getting any success.
I am getting below error:
'Problems loading script com.example.ValueSetProviderDescription
[object Object]
// prepopulate-description.js'
After this, my whole script is mentioned.
RTC v6.0.2
|
3 answers
Hi Shuchita,
Comments
Ralph Schoon
commented Feb 03 '17, 10:21 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Also read Process Enactment Workshop for the Rational solution for Collaborative Lifecycle Management Lab 5. It is relatively simple to create a calculated value (and not a valueSet provider.
Ralph Schoon
commented Feb 03 '17, 10:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Also Note, that default values can be calculated, but the available information when creating a work item is very small.
Also note that calculated values and manually editing attributes is a bit of a conflict and usually you would make calculated attributes read only.
|
Hi Shuchita,
Comments
Shuchita Tripathi
commented Feb 03 '17, 9:15 a.m.
dojo.provide("com.example.ValueSetProviderDescription");
(function() {
dojo.declare("com.example.ValueSetProviderDescription", null, {
getValueSet: function(attributeId, workItem, configuration) {
console.log("My messages");
var descr = "Some value";
var attr = "com.ibm.team.workitem.attribute.business"; //ID of attribute Business.(Business is an enum)
var val_bus = workItem.getValue(attr);
var hcs-lunar = "com.ibm.team.workitem.enumeration.business.literal.l4"; //ID of value of Business,for which Desc has to be changed
if (val_bus === hcs-lunar){
descr = "Changed value";
return descr; }
return descr;
}
});
})();
Shuchita Tripathi
commented Feb 03 '17, 9:16 a.m.
I have never done coding. So please ignore the stupid mistakes. :( |
Thank you Dinesh and Ralph for your help!!
The script is working now.
Somehow, I just commented out one line and it started working.
This is the line which I commented:
var hcs-lunar = "com.ibm.team.workitem.enumeration.business.literal.l4";
I dont understand what was the issue with this line.
Below is the working code.
----------------------------------------------------------------------------------------------------
dojo.provide("com.example.DescriptionValue");
(function() {
dojo.declare("com.example.DescriptionValue", null, {
getValue: function(attributeId, workItem, configuration) {
console.log("My messages");
var descrip = "";
var attr = "com.ibm.team.workitem.attribute.business"; // ID of attribute Business. (Business is an enumeration)
var val_bus = workItem.getValue(attr);
//console.log(val_bus);
//var hcs-lunar = "com.ibm.team.workitem.enumeration.business.literal.l4"; //ID of value of Business,for which Desc has to be changed
if (val_bus === "com.ibm.team.workitem.enumeration.business.literal.l4"){
descrip = "Changed Value";
return descrip;
}
return descrip;
}
});
})();
|
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.