# Use Case AUTOWORK-402 - Allow a status change only if rules are met

Project: Stream Workflows & Automations
Status: specified
URL: https://community.openproject.org/work_packages/AUTOWORK-402

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |

## Details

| Attribute | Value |
| --- | --- |
| Priority | Medium |

## Costs

| Attribute | Value |
| --- | --- |
| Spent units |  |
| Labor costs |  |

## Description

**Status change is blocked when field values do not** _**fulfill conditions**_ **of defined rules**. Several rules can apply to the same status change. A rule can:

*   compare a field with a fixed value or with another field
    
*   check if a text follows a pattern, e.g. an ID like &quot;ABC-1234&quot;
    
*   check related work packages, e.g. whether all children are closed
    

Example: If a user sets a work package to Done while no target version is set, or while a Planned Availability Date lies in the past, or the child work package is still open, the user would see a dialogue &quot;This work package cannot be set to Done: a target version must be set&quot; or &quot; The planned availability date must be today or later&quot; and/or &quot;This work package cannot be set to Done: all child work packages must be closed&quot;

**User story**  
As an admin, I want to define rules a work package must meet before a status change, so that work packages only move forward when their data is correct.

**Acceptance criteria**

1.  An admin can define rules for a status change that compare a field with a fixed value, with another field or with today&#x27;s date, check a text against a pattern, or check the status of child work packages
    
2.  If several rules apply to one status change, all of them must be _satisfied_
    
3.  If a rule is not met, the user can’t make the status change and sees what they _need to do to continue_
    
4.  If several rules are not met, the user sees all of them _~~at once~~_
    
5.  If all rules are met, the status changes
    
6.  Rules are only checked when _a user tries to change status_. Editing a field without changing the status is not blocked
    
7.  The rules apply everywhere a user can change _the_ status: work package view, work package lists, boards, bulk edit, team planner.
    
8.  Status changes through the API (like scripts or integrations) follow the same rules as changes made by users via the UI and get the same message if a rule or several rules are not met
    

**Open Questions:**  
Should we allow admins to write their own error message per rule? (Jira allows this)
