Condition scripting String List Type issues
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.
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
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.
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.
Comments
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.
2 votes