It's all about the answers!

Ask a question

Condition scripting String List Type issues


Timothy Esau (1715) | asked Jun 01 '15, 5:12 p.m.
edited Jun 03 '15, 9:53 a.m.
EDIT: It seems that the reason causing this was the differences between the JavaScript engine on the browser and the JavaScript engine running on the eclipse client and the ccm server.


Hello,
     I am trying to write a condition script that will make a String List required when a checkbox in an Enum list is selected. For example, the user selects "ticket reported by external customers" checkbox in the Customer issues attribute Enum List.  When this box is selected it will cause the Attribute "Customer names", which is of type String List, to become required, and will require that at least one string is inside of the string list. 

     Currently in the web UI, when I select "ticket reported by customer", the red asterisk appears next to the "Customer names" attribute, however I am allowed to save the defect with no values in the string list.  I have other condition scripts running so I am pretty sure that the condition script is set up properly. I also notice that in the eclipse client, the red asterisk for required does not appear for the field "customer Names" when I select "ticket reported by external customers" like it does in the web UI. I have added the "customer names" into the Required Attributes for type and state for testing purposes and when there are no values in the string list the server throws an error "Attribute 'Customer Names' not set. the 'Customer names' attribute needs to be set (work item 100)."  so I know that there is a way for the server to check if requirement based off of the values inside the string list.  Is it currently not possible to make a string list a required field using condition scripting, or am I missing something.  Thank you very much.

Accepted answer


permanent link
Donald Nong (14.5k414) | answered Jun 02 '15, 2:46 a.m.
Debug your script in Eclipse as well, as the JavaScript engine in Eclipse can behave differently to your browser. When you use RTC Eclipse client, or when the script is evaluated on the server side, it's the Eclipse JavaScript engine at work. If the RTC Eclipse client does not flag the attribute as required, you can expect the CCM server (also based on Eclipse) will do the same thing.

The JavaScript console.log() function output will appear in the Eclipse .log file. For CCM Server, you can find the .log file under tomcat/work/Catalina/localhost/ccm/eclipse/workspace/.metadata/.log if using Tomcat.
Timothy Esau selected this answer as the correct answer

Comments
2
Timothy Esau commented Jun 03 '15, 9:49 a.m.

It seems to be the case that the JavaScript engine running on the eclipse client, as well as the server is very much different than the JavaScript running in our browser.  After looking at he logging, many of the methods that were working in the browser were behaving differently eclipse client side, which is what was causing the discrepancies.

One other answer



permanent link
Ralph Schoon (63.1k33646) | answered Jun 02 '15, 3:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Conditions don't prevent from saving if
  • The operational behavior is not configured
  • The severity is not error

JavaScript has issues with List types, I think you should get a string. Not sure.

Your answer


Register or 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.