It's all about the answers!

Ask a question

How to block work item link from being removed on specific state?


Parveen Patel (77125) | asked Mar 07 '16, 2:05 a.m.
edited Mar 07 '16, 11:41 p.m.

Hi All,

I have written an operation advisor which will validate work item links on specific state.

Now I need to block the work item link from being removed from work item on closed state.

Is there any way to do this using API?

Consider the below scenario where advisor does not prevent work item save operation:

1.      We have “Task” work item and we are moving task work item from New to In progress state, our precondition will check the parent link and if not present show the error message to add Parent work item.

 

2.      When work item is moving from In progress to Closed state ,if we select action remove parent reference and click save button then it will get saved and parent work item link will get removed from the child work item, because while moving to closed state parent link is present so precondition get matched, after saving it will get removed.

Any help is much appreciated.

Thanks in advance.

One answer



permanent link
Ralph Schoon (63.1k33646) | answered Mar 07 '16, 2:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You write an operation advisor that checks the links before and after the save and prevents saving in case anything you don't want to gets deleted. As far as I know this is the only way. Please note, some link types e.v. CLM such as tracks/contributes to don't trigger the work item save action if changed. You won't be able to do anything about them for this reason.

Comments
Parveen Patel commented Mar 07 '16, 3:44 a.m.

Thanks for your response.

Could you please tell me how to check links before and after save using server side API?


Ralph Schoon commented Mar 07 '16, 3:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

As far as I can tell, you can access the old state and the new state in an advisor. You should be able to access the references of the old state and the references of the new state and, based on that, asses the changes by comparing them.


Parveen Patel commented Mar 07 '16, 6:37 a.m.

In my precondition I have checked link references of old state and new state,

but it will not block link from being removed


Ralph Schoon commented Mar 07 '16, 6:48 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am not sure what to read into the statement above.

If an advisor/precondition is supposed to prevent an operation under some circumstances, it has to fail. See https://rsjazz.wordpress.com/2014/05/26/only-owner-can-close-workitem-advisor/ as an example.


Parveen Patel commented Mar 07 '16, 11:45 p.m.

Hi,

Consider the above scenario in question where precondition does not prevent save operation


Ralph Schoon commented Mar 08 '16, 2:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I think all questions have been answered and continuing this discussion does not seem to make a lot of sense to me. Good luck!

showing 5 of 6 show 1 more comments

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.