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

Script Based Validation with Attribute Validation is not work

I trying to wirte a Script Based Validation.with precondition Attribute Validation.it will check if the value is vaild while save the workItem.but is seems the Attribute Validation is not work.
Below is my step:

1.Create a new Script-based validator. Use the following Javascript

dojo.provide("com.example.Validator");













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













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













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




























(function() {




























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













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













var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;













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













        validate: function(attribute, workItem, configuration) {













    













if (workItem.getValue(WorkItemAttributes.CREATOR) === workItem.getValue(WorkItemAttributes.OWNER)) {













                return Status.OK_STATUS;













            } else {













                 return new Status(Severity.ERROR, "Pls Keep them same" );














            }













      













        }













    });













})();

2.Add the Attribute Validation pre-condition for the Save Work Item(server) operation in Team Configuration > Operation Behavior.

3.Assign this validator to the Owned By attribute in Work Items > Types and Attributes.adding dependencies on the Creator.

Then save and open a workItem.

When do the test.if the CREATOR is different from OWNER.it will share error message in page.
but when save.it will save sccessful.

















Why the Attribute Validation is not work and prevent me save and return error message?
Can you give some ideas?thanks.

0 votes



2 answers

Permanent link
Hi Yu,

I just want to make sure. Have you enabled script based customize on ccm/admin advanced property page? If so, can you put some console.log ("test") to know if it is executed or not.

0 votes


Permanent link
 Also verry common is to configure the operational behavior incorrect. The rules that apply are: Process behavior lookup in Rational Team Concert 2.0
The screenshot I can see as moderator, shows the validation works, as it shows the error markup. so I am not sure what happens.

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: Nov 24 '15, 10:56 p.m.

Question was seen: 2,899 times

Last updated: Nov 25 '15, 2:37 a.m.

Confirmation Cancel Confirm