It's all about the answers!

Ask a question

[closed] RTC: visibility does not work when setting Category with Java API

Luca Martinucci (1.0k294112) | asked Jun 16 '16, 11:49 a.m.
closed Jun 17 '18, 7:55 a.m.
I have written a server-side extension that sets automatically the Category (i.e. the "Filed Against" attribute) on a work item.
The attribute is actually set with the correct value, but the work item visibility is not impacted.
I mean, every user in the project area can see the work item, even if he is not a member of the Team Area that is associated to the Category.
But, if I change manually the Category to a different value, and then back to the original value, then the visibility works as expected.
Is anybody aware of this strange behaviour?
And are there any solutions/workarounds?

sam detweiler commented Jun 16 '16, 1:06 p.m.

typically that means the api approach you used didn't quite work correctly..

can you show us what you were doing?

The question has been closed for the following reason: "I found myself the answer" by lumar Jun 17 '18, 7:55 a.m.

One answer

permanent link
Luca Martinucci (1.0k294112) | answered Jun 17 '16, 3:42 a.m.
Sam, I found the cause of this behaviour.
I was setting the Category in a Precondition (operation advisor).
I know that modifiying a work item in an advisor is not supported and against any best practice, but I was taking my risks, because the Category was a required attribute in the target state of the transition, so I needed to set it before the out-of-the-box advisor that checks the required attributes was run.
Now I have the Filed Against attribute an optional (not required) attribute in that state, so I've been able to "move" the setting of the Category in a Follow-up action.
When the Category is set in a participant, the work item visibility works as expected.
So, it seems that advisors are not able to set the visibility on work items, whereas participants are.

sam detweiler commented Jun 17 '16, 8:27 a.m.

yes, don't attempt to change data in advisors..

they are to 'advise'..