Hi Everyone,
We have a set of subtasks and need to enforce a sequential flow, ensuring that the next subtask cannot transition until the previous one is marked as Done.
Is there a way to achieve this using Jira Cloud’s native functionality or automations?
Would appreciate any suggestions or alternative approaches to handle this use case.
Thanks,
Bhavikaa
Hi All,
I successfully achieved this use case using the JMWE scripted validator. Sharing the steps and script below for reference in case anyone is looking for a similar solution.
Step 1: Identify the "Previous" Subtask
Define what qualifies as the "previous" subtask. In this case, I used the subtask ID to establish the order.
Step 2: Add a "Scripted (Jira Expression)" Validator
1. Navigate to the subtask workflow in Jira Cloud.
2. Select the transition you want to restrict (e.g., "In Progress," "Done," etc.).
3. Go to Validators → Click Add Validator.
4. Choose "Build-your-own Validator (JMWE app)".
5. Use the following Jira Expression:
// Ensure the issue has a parent (i.e., it's a subtask)
issue.parent &&
(
(subtasks => {
// Sort subtasks by numeric ID
let sortedSubtasks = subtasks.sort((a, b) => Number(a.id) - Number(b.id));
// Get a list of subtask IDs in sorted order
let subtaskIds = sortedSubtasks.map(s => s.id);
// Find the index of the current subtask
let index = subtaskIds.indexOf(issue.id);
// Allow the first subtask OR ensure the previous subtask is "Done"
return index == 0 || (index > 0 && sortedSubtasks[index - 1].status.name == "Done");
})
(issue.parent.subtasks) // Correctly reference the subtasks of the parent issue
)
Let me know if you have any questions.
Thanks!
Hi All,
I successfully achieved this use case using the JMWE scripted validator. Sharing the steps and script below for reference in case anyone is looking for a similar solution.
Step 1: Identify the "Previous" Subtask
Define what qualifies as the "previous" subtask. In this case, I used the subtask ID to establish the order.
Step 2: Add a "Scripted (Jira Expression)" Validator
1. Navigate to the subtask workflow in Jira Cloud.
2. Select the transition you want to restrict (e.g., "In Progress," "Done," etc.).
3. Go to Validators → Click Add Validator.
4. Choose "Build-your-own Validator (JMWE app)".
5. Use the following Jira Expression:
// Ensure the issue has a parent (i.e., it's a subtask)
issue.parent &&
(
(subtasks => {
// Sort subtasks by numeric ID
let sortedSubtasks = subtasks.sort((a, b) => Number(a.id) - Number(b.id));
// Get a list of subtask IDs in sorted order
let subtaskIds = sortedSubtasks.map(s => s.id);
// Find the index of the current subtask
let index = subtaskIds.indexOf(issue.id);
// Allow the first subtask OR ensure the previous subtask is "Done"
return index == 0 || (index > 0 && sortedSubtasks[index - 1].status.name == "Done");
})
(issue.parent.subtasks) // Correctly reference the subtasks of the parent issue
)
Let me know if you have any questions.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vishal Biyani ,
We have a predefined set of subtasks for different scenarios, which are created automatically via automation. Currently, we are not using any custom field to define the sequence; instead, the sequence is based on the issue key.
Would you recommend using a custom field to store the sequence, or is there a better approach?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for sharing this article. I’ve already gone through it, but it doesn’t serve our purpose since we want to completely prevent/hide the transition in all other subtasks until the previous one is marked as Done.
Let me know if you have any other suggestions or workarounds to achieve this use case.
Thanks,
Bhavikaa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.