Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Attribute validation is not working - please help

Hello,

I am trying to use condition - validator approach for working with required attributes in my application. In condition, I am using check for state and action to set attributes as required and this is working fine. In validator, I am checking if the field value is unassigned or blank, and in that case, I am throwing an error message
like - return new Status(Severity["ERROR"], message);
The validator is firing correctly and on error, I am able to see a red cross mark at the attribute to which I have attached the validator. On mouse over that cross mark, I can see right eror message.

The issue is, in spite of throwing this error message, the defect is being saved to next state.

I have also added the pre-condition of attribute validation to Save Work Item (server) for Everyone. I am configuring Operation Behavior section of Team Configuration.
I have only one team area in my project area.

Please help to resolve this situation. I really appreciate your advice.

0 votes


Accepted answer

Permanent link
I found an issue in my environment and after resolving that, attribute validation is working fine.

There was an empty script which was showing errors in the console log. I removed it from Links.

Now, the work item is not saved with validation errors.
Ralph Schoon selected this answer as the correct answer

0 votes


6 other answers

Permanent link
We described how this works here: https://jazz.net/library/article/1093 (Lab 4 and 5)

From your description it sounds as if everything is set up correctly and should work.I think I remember there were issues with certain versions of RTC where the save was not blocked.

0 votes

Comments

Hello Sir,

Thanks a lot for your guidance.

RTC version for both my server and client is 4.0.5. Can the issue be associated with this particular version? Please advise.

I just tried a simple regular expression validator on 4.0.5 on the description field.
Configured correctly, it works as expected and prevents the save.

I tried with a script and the save was not prevented.

Well, after playing around with it, closing the client and web session, and retrying, it works with a script too.


Permanent link
Hello, I have the same problem.

In the validator, I am throwing an error message like - return new Status(Severity["ERROR"], message);
The validator is firing correctly and on error, I am able to see a red cross mark at the attribute to which I have attached the validator. On mouse over that cross mark, I can see right eror message.

The issue is, in spite of throwing this error message, the work item is being saved to next state.

I have also added the pre-condition of attribute validation to Save Work Item (server) for Everyone. I am configuring Operation Behavior section of Team Configuration.

RTC Version: 5.0.1

0 votes


Permanent link
RTC 5.01 here, same problem, I have the validator working properly, I have the attribute validation precondition, the validation error message is displayed but workitem can be saved despite of the invalid field, I have logged bug already on this aspect

https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=337340


0 votes

Comments

I created this basic script:

/***********
 * Licensed Materials - Property of IBM
 * (c) Copyright IBM Corporation 2011. All Rights Reserved.
 *
 * Note to U.S. Government Users Restricted Rights:
* Use, duplication or disclosure restricted by GSA ADP Schedule * Contract with IBM Corp. ***********
/ dojo.provide("com.example.Validator");

dojo.require("com.ibm.team.workitem.api.common.Severity"); dojo.require("com.ibm.team.workitem.api.common.Status");

(function() {

var Severity= com.ibm.team.workitem.api.common.Severity; var Status= com.ibm.team.workitem.api.common.Status;

dojo.declare("com.example.Validator", null, {

    validate: function(attribute, workItem, configuration) {

        return new Status(Severity["ERROR"], "Validation failed");

    }
});

})();


Then I configured the attribute (description) and the operational behavior.

It works nicely for me in 5.0.1. So I have to assume you do something wrong.


Permanent link
Hello Ralph,

Thanks for spending time to debug this issue.

First thing I did is copied your script and configured Description attribute with this validator and checked.
The work item is saved, even if there a validation error on the description.

So, pre-condition is the problem for me. That is where I am going wrong.

Could you please let me know the steps you followed to enable the pre-condition in 5.0.1

Alejandro,

You can also try this basic script in your environment and see if it works for you.

0 votes


Permanent link
Yes. not working in mine either

0 votes


Permanent link
I am on RTC Version 5.0.1 and its all fine here.

0 votes


Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Feb 19 '14, 11:17 p.m.

Question was seen: 5,860 times

Last updated: Mar 13 '15, 5:28 a.m.

Confirmation Cancel Confirm