แชร์ผ่าน


TRANSITION XML element

Azure DevOps Server 2022 - Azure DevOps Server 2019 | TFS 2018 - TFS 2013

You use the TRANSITION element to specify a valid progression or regression from one state to another for a type of work item. The TRANSITION element is a required child element of the TRANSITIONS element.

To modify the workflow, you modify the definition for a work item type. See Modify or add a custom work item type.

Syntax

<TRANSITION from="NameOfStartingState" to="NameOfEndingState" for="UserGroupName" not="UserGroupName">  
       <ACTIONS> . . . </ACTIONS>  
       <REASONS> . . . </REASONS>  
       <FIELDS> . . . </FIELDS>  
</TRANSITION>  

Attributes and elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description
from Required. The name of the state from which the work item is transitioning.
to Required. The name of the state to which the work item is transitioning.
for Transition attribute.

Optional. The name of a user or group who is allowed to perform the transition.
not Transition attribute.

Optional. The name of a user or group who is restricted from performing the transition.

Note

Rules that use for and not attributes aren't supported in Azure DevOps Services.

Child elements

Element Description
ACTIONS Optional. Defines a collection of ACTION elements that each define an action string that can be used when calling the WorkItem.GetNextState method to get the post-action state of the work item.
REASONS Required. A collection of DEFAULTREASON and REASON elements that define valid reasons the work item can complete the transition.
FIELDS (Workflow) Optional. A collection of FIELD (Workflow) elements that reference the field definitions that are defined for the type of work item.

Parent elements

Element Description
TRANSITIONS Required. A collection of TRANSITION elements that define the valid state transitions for the work item type.

Remarks

TRANSITION is a required child element of TRANSITIONS.

You must define exactly one transition to move the work item from nothing (from="") to a named state such as Active. This transition identifies the default state for a new work item.

All valid transitions between two states must be specified. If no transition is specified, then by default no transition is allowed.

Additionally, you can optionally use the attributes for and not in the transition element of workflow to refine who is and who is not able to perform a transition. When you do this, denies takes precedence over allows. If neither of these attributes is specified, anyone can modify the work item.

Multiple groups are supported only by creating a parent group and specifying that parent group in the TRANSITION element. To learn more about the for and not attributes, see Rules and rule evaluation.

Example, define reasons

In the following example, the reasons are defined for the transition from the Active to the Resolved workflow state.

<TRANSITION from="Active" to="Resolved">  
   . . .  
   <REASONS>  
      <DEFAULTREASON value="Fixed"/>  
      <REASON value="Deferred"/>  
      <REASON value="Duplicate"/>  
      <REASON value="As Designed"/>  
      <REASON value="Unable to Reproduce"/>  
      <REASON value="Obsolete"/>  
   </REASONS>  
   . . .  
</TRANSITION>  

Example, restrict transition

In the following rule, the ability to transition a work item from the Resolved to the Completed state is restricted to all project testers, except for new testers who have just joined the team.

<TRANSITION from="Resolved" to="Complete" for="[project]\AllTesters" not="[project]\NewTesters">  
</TRANSITION>