Java Script Validator for Category type Attribute not working
![]() I am using RTC 6.0.3 server. There is a problem with a validator script that is trying to prevent the selection of the top two tiers of a Category type attribute. The problem is that on the display the little red "!" icon appears on the display when the user selects the TOP category or the NEXT category (as expected) but when the user clicks the Save button, only the TOP category is blocked. The work item is able to be saved with the NEXT category even though after the save the red "!" icon is still marking the attribute on the display. Code is As follows for the validate function of the validator script:
validate: function(attribute, workItem, configuration) {
A workaround that seems to work is to use the UUID of the invalid categories:
Using the browser debugging capabilities to step through the code shows that whether I am using the getValue or getLabel configuration there is no change in how the validator script works. I don't like to hard-code UUID's in the java script because the UUID is different from project to project and the script has to be modified to put this on the production project after developing and testing the script on the test project. |
One answer
![]()
Ralph Schoon (62.7k●3●36●43)
| answered Dec 17 '18, 3:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER It is possible to make attribute customization scripts configurable. It basically uses the same information format that the attribute customization use in general.
This avoids hard coding.
You might also want to try to use Chrome to debug the scripts to better understand the values you are getting.
Finally, check for the equal operator for JavaScript e.g. === vs. == which might or might not contribute to your issue.
|
Comments
If I don't "Accept" any answers, it means I don't have the rank on this forum to give it a thumbs down yet.