Edwin Castro

In out work items we have many scenarios where we have two states, A and B, where the Activated Date field is set automatically in the A->B transition and set to null in the B->A transition.

Code Snippet

<TRANSITION from="A" to="B">
<FIELDS>
<FIELD refname="Microsoft.VSTS.Common.ActivatedDate">
<SERVERDEFAULT from="clock" />
</FIELD>
</FIELDS>
</TRANSITION>

<TRANSITION from="B" to="A">
<FIELDS>
<FIELD refname="Microsoft.VSTS.Common.ActivatedDate">
<EMPTY />
</FIELD>
</FIELDS>
</TRANSITION>


If the I create a work item and transition from A to B, then Activated Date gets set only after the work item is saved. Now that the work item is in state B, if I transition the from B to A, then Activated Date gets set to null immediately in the UI (prior to a save). Without saving, I transition back to state B (as would occur in situation where the state was changed in error and corrected prior to saving) and the UI does not refresh to the previous value and if saved the field remains null (and now in an invalid state because the field is not set in a state where it should be set).

From a user's perspective, they have undone the latest change and would expect all data to be reverted (our users have expected this behavior) but in reality the change has already occurred and the only way to "undo" the change is not to do it all... In other words, the only way for the user to continue without corrupting the data (and they usually don't know that they have unintentionally corrupted the data) is to close without saving and start over.

I'm looking for a way to specify that the <EMPTY /> rule doesn't get executed until save-time so that if a user makes a mistake as specified above we won't get any unintentional data corruption. I've tried moving the <EMPTY /> rule to occur in state A without success. I also tried wrapping the <EMPTY /> rule with <WHENNOT field="Microsoft.VSTS.Common.ActivatedDate" value=""> in state A without success.


Re: Team Foundation Server - Work Item Tracking Activated Date is set to null on UI change (not save)

Aliaksei Baturytski - MSFT

This behavior is actually by design. For SERVERDEFAULT rule time on the server cannot be determined until the item gets saved, so the field is greyed out and disabled. On the other hand, EMPTY rule can be applied right away.

Our rules engine simply reacts to a change and evaulates rules triggered by this change. Changing a field back to the original value does not revert all rules done by the previous change; it simply executes a different code path.

Anyway, what is your scenario Why do you need to wait until the work item is saved to clear field's value

Thanks,

Alex





Re: Team Foundation Server - Work Item Tracking Activated Date is set to null on UI change (not save)

Edwin Castro

I want the clear the field when I am in state A (from state B) but I do not want the effect to take place when the user changes the State UI control. If the user changes the State control to state A by mistake then the field gets cleared when it shouldn't have been. In my experience, users "fix" this mistake by changing the State control back to the correct state and continue editing other fields but the ActivatedDate field remains cleared when they save. I need a way to prevent the clearing of the field in these mistake scenarios.




Re: Team Foundation Server - Work Item Tracking Activated Date is set to null on UI change (not save)

Aliaksei Baturytski - MSFT

I am afraid this scenario is not supported - even here at Microsoft we do not handle this scenario very well (check Bug work item type definition from MSF Agile template, for example). It looks like having a rule like <SERVERDEFAULT from="value" value=""/> would solve that problem. I will let the responsible parties know about this problem.

Thanks,

Alex





Re: Team Foundation Server - Work Item Tracking Activated Date is set to null on UI change (not save)

Gregg Boer MSFT

Thanks for taking the time to post this request and for detailing your scenario. As Aliaksei said, we don't support this today, but I have added this to the list of what we are considering for future releases. Thanks.




Re: Team Foundation Server - Work Item Tracking Activated Date is set to null on UI change (not save)

Edwin Castro

I forgot to reply and thank Aliaksei for his input. I appreciate that this has made it into your feature/bug backlog.