azure-devopsrulesazure-devops-server-2019azure-devops-server

Azure DevOps Server 2019 - Rules, make required attachments on state change


I'm new using Azure DevOps Server and i having some problems creating rules. I'm trying to make a rule that doesn't allow the user to change the state of a Feature on the Board if this Feature doesn't have any attachment on it.

The rule i created is something like this: Test Rule . Right now with this rule it still permits the user to change state.

I practiced with other rules where i made required to have a description on state change and it worked fine not allowing the user to change state and showing "error" on the board.

I was testing with the querys if the feature I was using had any files attached but the result showed the work item correctly when i used that "Attached File Count" = 0.

If someone had some issue similar to this and can help me with it I'll apprecite it very much.


Solution

  • The reason your rule setting doesn't work is that the default value of the Attached File Count is 0, so the Make required Attached File Count set in your Actions is not valid.

    As a workaround ,you can achieve it through the following setting:

    First, you can create a new field in the Feature item, as shown below.

    enter image description here

    Then we need to new two rules :

    enter image description here

    enter image description here

    If you don't want the needAttachment field to be displayed in the work item page to prevent being manually modified, you can choose Hide from layout option.

    enter image description here

    After setting, when someone want to modify the state, if there is no attachment, he will get an error.

    enter image description here