| title | Add a custom rule to a work item type |
|---|---|
| titleSuffix | Azure DevOps Services |
| description | Add a custom rule to a work item type defined for an inherited process and project |
| ms.custom | inherited-process |
| ms.service | azure-devops-boards |
| ms.assetid | 17A6AF2C-81E9-4717-971E-2621613AEB31 |
| ms.author | chcomley |
| author | chcomley |
| monikerRange | >= azure-devops-2019 |
| ms.topic | how-to |
| ms.date | 06/07/2021 |
[!INCLUDE version-gt-eq-2019]
Custom rules provide support for a number of business use cases, allowing you to go beyond setting a default value for a field or make it required. Rules allow you to clear the value of a field, copy a value into a field, and apply values based on dependencies between different fields' values.
[!INCLUDE temp]
With a custom rule, you can define a number of actions based on specific conditions. For example, you can apply a rule to support these types of scenarios:
- When a value is defined for Priority, then make Risk a required field
- When a change is made to the value of Release, then clear the value of "Milestone"
- When a change was made to the value of Remaining Work, then make Completed Work a required field
- When the value of Approved is True, then make Approved By a required field
- When a user story is created, make the following fields required: Priority, Risk, and Effort
- When current user is a member of "Project Administrators", then make Priority required
- When current user is not a member of "Project Administrators", then hide the Priority field
Note
You make a field required and specify a field default through the Options tab for the field.
Prior to defining a custom rule, review Rules and rule evaluation, Inherited process rule composition. For examples that illustrate common scenarios for applying rules, see Sample rule scenarios.
[!INCLUDE temp]
[!INCLUDE temp]
[!INCLUDE temp]
You add fields to a selected work item type.
-
Select the WIT to which you want to add a rule, choose Rules, and then choose New rule.
If you can't fill out the New work item rule dialog, you don't have the necessary permissions to edit the process. See Set permissions and access for work tracking, Customize an inherited process.
-
Name the rule and select the condition(s) and action(s) from the dropdown menus.
[!TIP]
Specify a name that builds off the field(s) you're acting on, or the conditions you're setting.Here we define that the Acceptance Criteria field is required when the State changes to Active and it is currently empty.
The sequence of actions you specify doesn't impact the behavior of the rule itself or its behavior with respect to other rules defined for the same WIT.
-
Once you've added a custom rule, open a work item and verify that the rule works as you intended.
You can temporarily disable a rule or delete it altogether.
You delete or disable the rule from the actions menu of the rule.
[!INCLUDE temp]

