Custom enumeration attr with JavaScript Condition: ReadOnly
The below works to effectively "hide" (i.e. so long as condition is true, editor presentation remains hidden) a String custom attribute but not so with an enumeration custom attribute. Does the js need to change or is this behavior not supported for enumerations? Js as follows:
dojo.provide("net.jazz.readonly.MaximoAppReadOnlyCondition.Condition");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.string");
(function() {
/*
* Answer true (read-only condition is met) if "Application" != "Maximo"
*/
dojo.declare("net.jazz.readonly.MaximoAppReadOnlyCondition.Condition", null, {
matches: function(workItem, configuration) {
var conditionValueTrigger_maximo= "Maximo";
var applicationValue= workItem.getLabel("application_enumeration");
var result = (applicationValue != conditionValueTrigger_maximo);
console.log("Application Name=" + applicationValue + " result=" + result);
return result;
}
});
})();
NOTE: When condition trigger is reached, target custom enumeration is able to have contents modified and persisted (not possible when condition not satisfied) but I want the behavior to emulate the custom String attribute presentation and not show Enumeration at all if condition not satisfied--this is a convenient way to hide the drop-down list unless a trigger condition value is met on a dependent enumeration.
I know I can populate the target's value list to "somewhat" achieve this behavior but I do not want the enum to appear unless dependent condition is satisfied to avoid confusion.
dojo.provide("net.jazz.readonly.MaximoAppReadOnlyCondition.Condition");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.string");
(function() {
/*
* Answer true (read-only condition is met) if "Application" != "Maximo"
*/
dojo.declare("net.jazz.readonly.MaximoAppReadOnlyCondition.Condition", null, {
matches: function(workItem, configuration) {
var conditionValueTrigger_maximo= "Maximo";
var applicationValue= workItem.getLabel("application_enumeration");
var result = (applicationValue != conditionValueTrigger_maximo);
console.log("Application Name=" + applicationValue + " result=" + result);
return result;
}
});
})();
NOTE: When condition trigger is reached, target custom enumeration is able to have contents modified and persisted (not possible when condition not satisfied) but I want the behavior to emulate the custom String attribute presentation and not show Enumeration at all if condition not satisfied--this is a convenient way to hide the drop-down list unless a trigger condition value is met on a dependent enumeration.
I know I can populate the target's value list to "somewhat" achieve this behavior but I do not want the enum to appear unless dependent condition is satisfied to avoid confusion.
Accepted answer
Wiliam,
read only is not hidden.
Read Only on condition is supported for 4.x using the condition as well as a precondition. If this does not work for a specific attribute type I would suggest to open a PMR or a defect.
Hidden on condition is not supported today, let alone in 4.0.1. I don't think there is a way around it. You might want to file an enhancement request.
read only is not hidden.
Read Only on condition is supported for 4.x using the condition as well as a precondition. If this does not work for a specific attribute type I would suggest to open a PMR or a defect.
Hidden on condition is not supported today, let alone in 4.0.1. I don't think there is a way around it. You might want to file an enhancement request.
Comments
Yes, I understand read only is not hidden, hence my use of quotes surrounding "hide" in my original post. I attempted to insert an image demonstrating the behavior when cust attr is string (label appears but no text box appears until condition on target is met) but as I do not have a > 60 reputation, alas, I could not. Perhaps the way the read only condition is implemented in js on cust str atttr is a bug but if so, it is a fortuitous one since it mimics the behavior I seek. That behavior is what I was seeking in the cust attr enum (i.e. no drop-down appearance but only label when trigger met.) I will log an enhancement request and make arrangements to update to a newer version of CLM to get L&G fixes/enhancements. Thank you!
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Nov 20 '13, 3:15 a.m.This might be a defect. Hard to tell, without knowing which version of RTC you refer to, it is hard to test.
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Nov 20 '13, 3:18 a.m.On a second thought, you are probably looking for a hide on condition which is not available yet, as far as I can tell.
Eric Jodet
JAZZ DEVELOPER Nov 20 '13, 3:29 a.m.Correct Ralph,
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Nov 20 '13, 3:39 a.m.I have talked to development about this as an additional feature. I am not sure there is an enhancement request though.
William Lucas
Nov 20 '13, 8:36 p.m.Thanks Ralph. I am using CLM 4.0.1
Eric, none of the OOTB solutions would work for my work item as I want it to remain hidden unless user selects a specific value in another custom enumeration attr. None of the 5 above meet the need (unless I'm missing something.)
Thanks for the information, however.
-Will