Sample Workflow Rules
Stateless Rule — a simple rule which defines an action to be performed upon a change made for an issue, depending on a condition.
Stateless Rule Sample
When this sample rule is active, then upon a change in an issue:
- YouTrack checks whether the Subsystem field is changed
- If a Subsystem value is changed, the issue should be automatically assigned to the Subsystem's owner.
The sample stateless rule in the Workflow Editor:
State-machine Rule — a rule to define transitions between some states of an issue. A state here is not only a 'State' field of an issue, but any field of an issue which can have a defined transitions from one value to another. However, the most obvious and most often used state-machine rule is about transitions between values of the State field.
State-machine Rule Sample
This sample 'State's lifecycle' state-machine rule defines the following transitions for the issue's 'State' field:
- Initial state is Submitted
- From initial state issue can be transmitted to the following states only:
- On event (action) Open the state's value should be set (should transit) to 'Open' state.
- From the 'Open' state only the following transitions are allowed:
- On event (action) Fix the state's value should be set (should transit) to 'Fixed' state.
- On event (action) Duplicate the state's value should be set (should transit) to 'Duplicate' state.
- On event (action) Can't reproduce the state's value should be set (should transit) to 'Can't Reproduce' state.
- From the 'Fixed' state only the following transitions are allowed:
- On event (action) Verify the state's value should be set (should transit) to 'Verified' state.
- On event (action) Reopen the state's value should be set (should transit) to 'Reopened' state.
- In addition, when the issue is set to Fixed state (on enter to the 'Fixed' state), the Subsystem field should be changed to "Testing".
- From 'Duplicate' and "Can't Reproduce' states the issue can be only transited to the 'Reopened' state (upon action 'Reopen')
- From the 'Reopened', the state's value can only transit to the 'Fixed' state upon event (action) Fix.
The sample statemachine rule in the Workflow Editor:
When a statemachine rule is applied to a project, then the field 'State' will be visually marked as 'workflow-driven field' with statemachine rule icon and in the drop-down list only allowed actions will be available:
Scheduled Rule — a rule to define scheduled events depending on a condition. For example, periodically check for issues with certain attribute values and notify a user.
Scheduled Rule Sample
Presented here 'Check for Due date and notify assignee' sample scheduled rule defines the following periodic action:
- Each day, at 8 AM sharp, YouTrack should check issues with a 'Due date' field, and if the Due date should expire in less (or exactly) the 2 days, then send a notification to the issue's assignee in the following format:
- Notification subject: "The Due date of the issue is less then 2 days"
- Notification text: "The Due date is less then 2 days for the issue <issueID>"
The sample scheduled rule in the Workflow Editor: