TheProvost
TheProvost

Reputation: 1893

TFS 2018 Transition Field Updates Not Working Properly

  1. I created two custom states in my TFS flow. (For Feedback and Assigned).
  2. I created two custom fields that will hold the date once it is transitioned to the state (Feedback Date and Assigned Date)
  3. During transition to a phase, I have set the value of the current serverclock to the mapped field.

<FIELD name="Assigned Date" refname="CustomFields.Groundup.Workitem.AssignedDate" type="DateTime" reportable="dimension" />
<FIELD name="Feedback Date" refname="CustomFields.Groundup.Workitem.FeedbackDate" type="DateTime" reportable="dimension" />

<STATE value="Assigned">
</STATE>

<STATE value="For Feedback">
</STATE>

 <TRANSITION from="For Feedback" to="Assigned">
  <REASONS>
    <DEFAULTREASON value="Assigned" />
  </REASONS>
	<FIELDS>
    <FIELD refname="CustomFields.Groundup.Workitem.AssignedDate">
      <SERVERDEFAULT from="clock" />
     </FIELD>
  </FIELDS>	
 </TRANSITION>
 
  <TRANSITION from="Assigned" to="For Feedback">
  <REASONS>
    <DEFAULTREASON value="For Feedback" />
  </REASONS>
	<FIELDS>
    <FIELD refname="CustomFields.Groundup.Workitem.FeedbackDate">
      <SERVERDEFAULT from="clock" />
     </FIELD>
  </FIELDS>	
 </TRANSITION>

Both dates (Assigned and Feedback date are updated for both transitions). Can someone push me to the right direction why it behaves this way and how to work around it.

Currently using TFS 2018 On Prem

Upvotes: 1

Views: 181

Answers (3)

Shamrai Aleksander
Shamrai Aleksander

Reputation: 15998

That`s really interesting situation but we can not see the full content of your work item type definition. However, you can test the workaround:

  1. Add new rule WHENNOT for your field (for example CustomFields.Groundup.Workitem.FeedbackDate).
  2. The rule something like that:

    <WHENNOT field="System.State" value="For Feedback">
        <READONLY/> //or frozen
    </WHENNOT>
    

Upvotes: 0

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31003

I've tested in Tfs2018.Update3.2 with the definition below and it works as expected. When transit from Assigned to For Feedback, field Feedback Date update to current time. When transit from For Feedback to Assigned, field Assigned Date update to current time.

<FieldDefinition name="Assigned Date" refname="CustomFields.Groundup.Workitem.AssignedDate" type="DateTime" reportable="dimension" />
<FieldDefinition name="Feedback Date" refname="CustomFields.Groundup.Workitem.FeedbackDate" type="DateTime" reportable="dimension" />

<State value="Assigned" />
<State value="For Feedback" />

<Transition from="Assigned" to="For Feedback">
  <REASONS>
    <DEFAULTREASON value="For Feedback" />
  </REASONS>
  <FIELDS>
    <FIELD refname="CustomFields.Groundup.Workitem.FeedbackDate">
      <SERVERDEFAULT from="clock" />
    </FIELD>
  </FIELDS>
</Transition>
<Transition from="For Feedback" to="Assigned">
  <REASONS>
    <DEFAULTREASON value="Assigned" />
  </REASONS>
  <FIELDS>
    <FIELD refname="CustomFields.Groundup.Workitem.AssignedDate">
      <SERVERDEFAULT from="clock" />
    </FIELD>
  </FIELDS>
</Transition>

Upvotes: 0

Shamrai Aleksander
Shamrai Aleksander

Reputation: 15998

You use the same CustomFields.Groundup.Workitem.AssignedDate field in both transitions.

Upvotes: 1

Related Questions