It's all about the answers!

Ask a question

How to detect changes in links (custom link types)

Ilona Krammer (159549) | asked Sep 19 '16, 6:12 a.m.
How can I detect changes that are made in links between work items? I have several use cases where I need to check:

- inform the user that he has to manually check some information because of a link change
- prevent a user from deleting a certain link (from one end where there can be several work items added, but on the other endpoint there is only one item and that must not be empty)

I only seem to get the latest change by retrieving the oldstate and then resolving the work item references, not the changes that were made in between (and not the original work item that was linked in case there were several changes made while editing a work item and only saving after that)

I hope I explained the problem in enough detail so you can help. (Otherwise please ask and I try to give an example - I just didn't want to write pages and pages)
Thank you!

2 answers

permanent link
Ralph Schoon (63.2k33646) | answered Sep 19 '16, 9:29 a.m.
Ilona, the use cases you describe seem to be automation, so you would likely have to react to an event or the save of a work item. You are talking about Preconditions/advisors or follow up actions/participants. You can fins examples for this kind of extensions here:
These extensions are Java based.

Please note that you can not detect changes to link types such as Tracks/Contributes to and other CLM link types

Ilona Krammer commented Sep 19 '16, 9:52 a.m.

Hi Ralph,
thank you for your answer - I am already working on a participant (I wouldn't know how else to access the work item references).
Can you point me to a specific example for link type changes since that is the part I cannot seem to find (server side Java extension).

I'm using my own link types so the problem with the CLM link types should not apply, right?

Ralph Schoon commented Sep 19 '16, 10:04 a.m.

For all I know a link can not change its type. You can only delete a link and create a link of a different type. You should be able to use the old and the new state and their references and compare those.

I cannot share an example unfortunately as the operational behavior I attempted to implement was supposed to work for the Tracks/Contributes to link type / CLM link flavors that you can not detect.

permanent link
sam detweiler (12.5k6195201) | answered Sep 19 '16, 8:40 a.m.
as I understand it, there is no change detection for links.

in 5.0.2 link changes are recorded in the history.

Work item link history


Ilona Krammer commented Sep 19 '16, 9:17 a.m.

Thank you!

I'm using 6.0.1 at the moment.

I don't quite get the link history to work either. I can check the checkbox and I see which links were added - but as soon as I delete the link even the adding of the link disappears from the history.

And do you have any idea if there is a request for that functionality? I searched but obviously I'm using the wrong search words since I'm getting a lot of stuff about linking change sets but not detecting changes in links

sam detweiler commented Sep 19 '16, 9:23 a.m.

I do not know if there are already RFE's.. I have not looked into the behavior of the link history functionality..

sadly, there is SO much stuff on the backlog, it is hard to make significant progress on other than a small slice.. 

Geoffrey Clemm commented Sep 19 '16, 9:31 a.m.

In order to maintain the history of deleted links, you need to enable the (rather unintuitively named) server property: "Enable automatic archiving of auditable links".   Also, when looking at the history of a work item, you need to click on the box which says "show link history" (this is off by default, because it slows down the history display).

Ilona Krammer commented Sep 19 '16, 9:53 a.m.

I have the server property activated and checked the "show link history". For some reason the entries about the links disappear as soon as I delete the link - which for me really isn't understandable. Is that actually the way it should work or am I doing something wrong..?

Ilona Krammer commented Sep 22 '16, 2:29 a.m.

I realized today that the setting to have changes in auditable links can be set in jts and ccm - I only set it once in jts it seems and that didn't work of course.
So at least now the user can look up the history - maybe I can work with that in code as well, but that's going to take a few more days until I can have a look at that (or maybe the setting now changed some data that comes back with changedreferences/deletedreferences/createdreferences (the functions that I had already tried but didn't return any correct data)

Thank you!
(and I'll post what I find as soon as I find it ;)

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.