How to block work item link from being removed on specific state?
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
Comments
Thanks for your response.
Could you please tell me how to check links before and after save using server side API?
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.
In my precondition I have checked link references of old state and new state,
but it will not block link from being removed
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.
Hi,
Consider the above scenario in question where precondition does not prevent save operation
I think all questions have been answered and continuing this discussion does not seem to make a lot of sense to me. Good luck!