How to autofill field value from other field value during transition?  
Author Message
Vladimir Bougay





PostPosted: Team Foundation Server - Work Item Tracking, How to autofill field value from other field value during transition? Top

We have a following problem.

In our work item type we have two states: Proposed and Active. Also we have two fields: System.AssignedTo and our own Company.VSTS.Common.Developer. During transition from Proposed to Active state every time user changes System.AssignedTo field we need automatically copy its value to Company.VSTS.Common.Developer field.

We tried to use COPY rule on Company.VSTS.Common.Developer with field=System.AssignedTo applied to transition (Proposed->Active) and even to Active state. It seems that copying is performed only once during changing State field of the work item. Subsequent changes to System.AssignedTo (before commit) don't propagated to Company.VSTS.Common.Developer field value (in Team Explorer). We need to update Company.VSTS.Common.Developer field every time System.AssignedTo field changes until transition commited.




Visual Studio Team System4  
 
 
Smitha S Saligrama





PostPosted: Team Foundation Server - Work Item Tracking, How to autofill field value from other field value during transition? Top

Hello Vladimir,

If you want the last System.AssignedTo value in Company.VSTS.Common.Developer field before commiting you can use "serverdefault"

It will look like

<SERVERDEFAULT from="field" value="System.AssignedTo"/>

This will make Company.VSTS.Common.Developer appear read-only on the form.



 
 
Aliaksei Baturytski - MSFT





PostPosted: Team Foundation Server - Work Item Tracking, How to autofill field value from other field value during transition? Top

SERVERDEFAULT's "from" attribute accepts only "clock" and "currentuser" values, so this won't work. However, could you check that you were actually using COPY rule, not DEFAULT The behavior you described is typical for DEFAULT rule, which doesn't change the value if it's not empty.

Thanks,

Alex


 
 
Vladimir Bougay





PostPosted: Team Foundation Server - Work Item Tracking, How to autofill field value from other field value during transition? Top

I'm aware of differences between DEFAULT and COPY rules. I sligtly modified WIT definition since last post. Below the interesting part of it:

<TRANSITION from="Proposed" to="Investigation">

<REASONS>

<DEFAULTREASON value="Investigate" />

</REASONS>

<FIELD refname="System.AssignedTo">
<VALIDUSER group="[Project]\Testers"/>
</FIELD>
<FIELD refname="Company.VSTS.Common.Tester">
<VALIDUSER group="[Project]\Testers"/>
<WHENCHANGED field="System.AssignedTo">
<COPY from="field" field="System.AssignedTo"/>
</WHENCHANGED>
</FIELD>
</TRANSITION
>

Everything points to the fact that this rule is fired every time when AssignedTo field changed in Team Explorer. But unfortunately Tester field value is set to value that was in AssignedTo field BEFORE transition (in Proposed state), not value just entered by user. In my opinion this behaviour is wrong, the value of Tester field should be set from the value of AssignedTo field just entered by user.

It seems to me that I already heard about this problem somewhere on the Internet.



 
 
Aliaksei Baturytski - MSFT





PostPosted: Team Foundation Server - Work Item Tracking, How to autofill field value from other field value during transition? Top

Yes, unfortunately our rules engine that is responsible for tracking field dependencies and handling rules has bugs, and this is why your type isn't working. We're working on improving that in the future version.

Thanks,

Alex


 
 
Vladimir Bougay





PostPosted: Team Foundation Server - Work Item Tracking, How to autofill field value from other field value during transition? Top

Is there hotfix available for this issue


 
 
Aliaksei Baturytski - MSFT





PostPosted: Team Foundation Server - Work Item Tracking, How to autofill field value from other field value during transition? Top

No, sorry.