Редактиране

Споделяне чрез


Add a rule to a work item type (Inheritance process)

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 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.

Important

The Inheritance process model is available for projects configured to support it. If you’re using an older collection, check the process model compatibility. If your on-premises collection is configured to use the on-premises XML process model, you can only use that process model to customize the work tracking experience. For more information, see Choose the process model for your project collection.

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.

Prerequisites

For guidance on tailoring Azure Boards to align with your specific business requirements, see About configuring and customizing Azure Boards.

  • Organization requirement: Ensure you have an organization in Azure DevOps.

  • Permissions:

    • Be a member of the Project Collection Administrators group.
    • Have collection-level permissions such as Create process, Delete process, Edit process, or Delete a field from organization set to Allow.
    • These permissions allow you to modify processes and fields within your organization.
  • Project process model requirement:

  • Permissions:

    • Be a member of the Project Collection Administrators group.
    • Have collection-level permissions such as Create process, Delete process, Edit process, or Delete a field from organization set to Allow.
    • These permissions allow you to modify processes and fields within your organization.

Open organization process settings

  1. Sign in to your organization (https://dev.azure.com/{yourorganization}).

  2. Select Organization settings.

    Screenshot showing Organization settings button for selection.

  3. Select Process.

    Screenshot showing highlighted Process button for selection.

  1. Sign in to your collection (https://dev.azure.com/{Your_Collection}).

  2. Select Collection Settings or Admin settings.

  3. Select Process.

    Screenshot showing highlighted Process button in Collection settings.

Note

When you customize an inherited process, any projects using that process automatically reflect the customizations. To ensure a smooth transition, we recommend creating a test process and project, which allows you to test your customizations before you implement them organization-wide. For more information, see Create and manage inherited processes.

Add a custom rule

You add fields to a selected work item type.

  1. Select the WIT to which you want to add a rule, choose Rules, and then choose New rule.

    Process, WIT, Bug, Layout, 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.

  2. 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.

    New rule form

    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.

  3. Once you've added a custom rule, open a work item and verify that the rule works as you intended.

Delete or disable a rule

You can temporarily disable a rule or delete it altogether.

You delete or disable the rule from the actions menu of the rule.

Delete or disable a rule

Note

Review changes made to an inherited process through the audit log. For more information, see Access, export, and filter audit logs.