Forum Discussion

DamienACT's avatar
DamienACT
Copper Contributor
Mar 07, 2024

Azure Boards - Trying to create a rule that prevents a workflow state from changing on conditions

Issue:

 

I am trying to create the following Azure Work Item based rule

 

Condition:

 

Condition 1: "State" is "New"

Condition 2: Current logged in user does NOT belongs to TEAM X

 

Action:

 

Do not allow the user to change the State.  I would also be happy with any option that does not allow the user to be able to change the workflow, like not showing the values, making the State field non editable,etc.    But everything I have tried is failing.  I have not only tried via the front end, but tried to combine the rules in API, but also gave an error.


Providing my attempted JSON(THAT FAILED) as an example of what I was hoping to achieve:

rule_data = {
    "name": "SecureStateForApproval",
    "conditions": [
        {
            "conditionType": "whenWas",
            "field": "System.State",
            "value": "New"
        },
        {
            "conditionType": "whenCurrentUserIsMemberOfGroup",
            "field": null,
            "value": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
        }
    ],
    "actions": [
        {
                    "actionType": "disallowValue",
                    "targetField": "System.State",
                    "value": "Pending Review"
        },
    ],
    "isDisabled": False
}

Thoughts?

 

In effect what I am trying to achieve is that any new work items must remain as new until an admin has had a chance to review and then progress the work item.

 

Thanks,
Damien

No RepliesBe the first to reply