It's all about the answers!

Ask a question

access to "linked" work items via a script-based validator?

Susan Hanson (1.6k2191193) | asked Jul 01 '13, 11:09 p.m.
I'm trying to create a script-based validator that needs to get access/use the values of attributes in linked work items.  For example, we have two custom work item types that use the dependsOn relationship (but we also have the same with parent/child relationships).   We want to not allow the child to be put into an "in progress" state when the parent is still in "Open", and also the same with the dependsOn relationship (the work item that Blocks the other cannot be in an "In Progress" state if the DependsOn one is still in Open).

We have been using some script-based attributes, so my thought was to add an attribute (although not in the editor) that has a validator that then would run when the work item is saved.  That validator would check the status of the two work items and determine if there are "data integrity" issues and if so, put up an error. If not, then the validator of this hidden field would return true.

However, I haven't found any examples of script-based validators (or calculated fields for that matter) that deal with a 2nd work item.

Is this possible??

One answer

permanent link
Ralph Schoon (61.5k33643) | answered Jul 02 '13, 2:27 a.m.
edited Jul 02 '13, 2:28 a.m.
Susan, the JavaScript API does not allow you to follow links. You would have to create a Java Based Validator or an advisor. See some more information about limitations of the JavaScript API here:

Your answer

Register or to post your answer.