How do I know in a validator script that a field has changed.
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
Please read https://jazz.net/wiki/bin/view/Main/AttributeCustomization carefully. Also check the links in that explanation. Also consider to look into https://jazz.net/library/article/1093 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 https://jazz.net/wiki/bin/view/Main/AttributeCustomization .
Also google for how to compare dates in JavaScript. There are many posts around this here in the forum, most tagged with attribute-customization.