Can EWM Calculated Value dojo read if there is a parent/child link for the Work Item
I am able to read the Custom Attribute values through a dojo script configured with Calculated Value.
From dojo, I wanted to check if there is any link associated to that Work Item & Link Type.
When adding Dependencies to the attribute, while all the Attributes are present, Links are not configurable as dependencies.
2 answers
You're correct, you can't set up dependencies on links, but you can get link information via the workItemProxy. Note that the use of the work item proxy is undocumented and therefore subject to change, so use at your own risk.
The following call will retrieve all links of the specified type, and return them as an array of objects that can then be further queried for basic information
const children = workItem.getProxy().getValue({ path : [ 'linkTypes', 'com.ibm.team.workitem.linktype.parentworkitem' ]} );
Thank you @davydnorris.
Following code in calculated value is able to fetch all links that were present before opening the work item.
const children = workItem.getProxy().getValue({ path : [ 'linkTypes']} );
But if the link is newly created & the Save button is pressed, newly created link is not read by the script. This means Script does not work onSave operation.
How to make the script work onSave operation.