It's all about the answers!

Ask a question

How do I know in a validator script that a field has changed.

Gil Parent (134) | asked May 30 '18, 5:27 a.m.
edited May 30 '18, 5:50 a.m. by Ralph Schoon (63.3k33646)

I have created scripts to validate dates. The dates cannot be before the current date at the time of the update but if I make a change for another field of the work item few days after, I don't want to check the dates fields.
How can I code my script to do that, how do I know that a field has been changed ?

One answer

permanent link
Ralph Schoon (63.3k33646) | answered May 30 '18, 5:49 a.m.

Please read carefully. Also check the links in that explanation. Also consider to look into there is a lot of information in the last two chapters.

Validators are called by the framework if one of the dependent attributes is changed. You don't know which. You basically read all the attributes you need for the validator (usually only the attribute this validates) and then return the verdict.

Note: Read the section about data formats .
Also google for how to compare dates in JavaScript. There are many posts around this here in the forum, most tagged with attribute-customization.

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.