Disallow few combinations of an Enum List
I have an Enumuration List Attribute (multi-select). Say the values are A,B,C,D&E.
How do I disallow few permutations like (when A is choosen, no other values are allowed; B,C,D&E cannot be allowed as a combination). Will a script based validation help ? |
Accepted answer
Yes you can use a script based validator to do that, but the implementation can be a bit complicated. First use the workItem.getValue() function to retrieve the current values of the attribute. This will be an array of JavaScript objects, with each containing four attributes - _eQualifiedClassName, iconUrl, id and label (you will be interested in the last two only). Loop through the array and process the labels - you can put them into a "Set" for easy access. Evaluate the chosen values, and return Status.OK_STATUS or a new error depending on the condition. The main body of the function will look like this.
var enumList = workItem.getValue("enumList"); Chidambaram L selected this answer as the correct answer
Comments
Chidambaram L
commented Aug 31 '15, 1:20 p.m.
Thanks for the detailed explanation and the script.
Donald Nong
commented Sep 03 '15, 9:20 p.m.
Depending on which client you are using, but it will not appear in the Tomcat console or the catalina.out file.
|
One other answer
the RTC UI design is to allow all changes, then reject them on submit. There is very limited support for interactive content access. The only one I know of is the tree view value set, where selecting one in column A will enable a subset of the entries in column B.
Comments
Chidambaram L
commented Aug 28 '15, 8:42 a.m.
By tree view value set, I believe you are referring to Dependent Enum, where 2 Enum attributes will be defined.
sam detweiler
commented Aug 28 '15, 9:12 a.m.
Yes, that is correct, dependant enum..
|
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.