Assign workflow based on fields value
I am trying to create the following basic workflow:
An issue can either be "To be developed" or "To be cleared with product owner".
If an issue is created as "To be developed", a development workflow (including statemachine) should apply.
Sample state changes:
Submitted
On Open -> Open
On Close -> Won't fix (*)
On Start work -> In Progress
On Fixed -> Test
On Verified -> Closed (*)
On Reject -> In Progress (assert that a comment has been added)
(*) = End of workflow
If an issue is create as "To be cleared with product owner", a feedback workflow (including statemachine) should apply.
Sample state changes:
Submitted
On Reject change -> Change rejected (*)
On Implement -> Implementing (new issue is created on which this one depends)
If created issue's state changes to Closed, change this issue's state to Implemented (*)
If created issue's state changes to Won't fix, change this issue' state to Not implemented (*)
(*) = End of workflow
Is this possible?
Please sign in to leave a comment.
Hello Danial,
the natural way is going to be implemented in next version, when feature http://youtrack.jetbrains.net/issue/JT-8639 is realized.
Now you can try the following workaround:
1. Create new workflow in Workflow Editor
2. Create statemachine rule:
statemachine to be machine for field State {
initial state Submitted {
}
state Submitted (Development) {
on Open[always] do {<define statements>} transit to Open
on Close[always] do {<define statements>} transit to Won't fix
on Start to work[always] do {<define statements>} transit to In Progress
on Fixed[always] do {<define statements>} transit to Test
on Verified[always] do {<define statements>} transit to Closed
on Reject[always] do {
assert comments.added.isNotEmpty: "Please add comment";
} transit to In Progress
}
state Open {
}
state Won't fix {
}
state In Progress {
on Fixed[always] do {<define statements>} transit to Test
}
state Test {
on Verified[always] do {<define statements>} transit to Closed
}
state Closed {
}
state Submitted (Management) {
on Reject change[always] do {<define statements>} transit to Change rejected
on Implement [always] do {
var newIssue = loggedInUser.createNewIssue("ProjectName");
newIssue.summary = "Source request: " + getId();
issue.depends on.add(newIssue);
} transit to Implementing
}
state Change rejected {
}
state Can't Reproduce {
}
state Implementing {
}
}
3. Create 2 stateless rule:
This workflows suggests that someone selects type "To be developed" or "To be cleared with product owner" and initial state will change accoring it.
Thanks a lot, that looks good. One unrelated question: How to copy and paste this into the workflow editor? I can't seem to do it...
Unfortunately there is no way to copy/past into Workflow Editor except simple strings(ex., states names), so you will have to type it manually.
Ouch. That's really unfortunate.