Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira Sub-task Rank

alexander_cartlidge June 5, 2023

Hi all,

Does anyone know a smart value that will return the rank number of a subtask. for example, I can get the rank number from a smart value specifically. as in {{issue.parent.subtasks.get(0)}} would give me the first sub task in the rank. But what I need is a smart value for the rank the sub task is. 

{{issue.rank_number}} - 

Put simply. I would like the rank number of a sub task, so I know which number iti is in the list of subtasks. any ideas?

3 answers

1 accepted

0 votes
Answer accepted
alexander_cartlidge June 7, 2023

Just to close this. I couldn't find a solution using automation. I did it through script runner with the following:

Issue parent = issue.getParentObject();
 ArrayList<Issue> testSteps = (ArrayList<Issue>) parent.getSubTaskObjects();
       int currentTestStepPosition = testSteps.indexOf(issue)
0 votes
Stephen Kaiser
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 27, 2024

Removed by user

0 votes
Valerie Knapp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 5, 2023

Hi @alexander_cartlidge , thanks for your question.

To get the smart value for the custom field issue rank, I checked first in the Issue menu, Custom fields, to get the custom field ID for Rank.

Then, I followed these instructions to see the value in the individual issue - Find the smart value for a field | Cloud automation Cloud | Atlassian Support

But I think that once you have the custom field ID in your system, you should be able to get the rank for the issue using the smart value. Jira smart values - issues | Cloud automation Cloud | Atlassian Support

I don't know if this is helpful for your or not. If you need more assistance, please share the automation rule and either I or someone else can take a look and try to help you further.

Cheers

alexander_cartlidge June 5, 2023

Hi @Valerie Knapp ,

Thanks for the information. Unfortunately, I can't get the JSON view to function. But I'm not sure it would show it if I could.  It's not the Rank field I need, but rather the order of the sub tasks in the issue.

I would like to know if there is a smartvalue that would return the order number of the sub task. I can get it the other way around. So if I specially use {{issue.parent.subtasks.get(WHATEVER NUMBER)}} the automation will return that issue key. But I need it the other way around. So the smart value grabs the number not me asking for a specific one. 

At the moment I don't have a rule. I'm just trying to establish if it's possible. :) But the things I can get are:

{{#issue.parent.subtasks}}{{index}}{{/}} - lists the number of subtasks, (0123...)

{{#issue.parent.subtasks}}{{index}}{{/}} - lists the subtasks by key

{{issue.key}} -  gives me the issue key (no surprise :D ) 

But my use case is that we have user tests that we use Jira for. A Test Case is created and the sub tasks are used as test steps. These have to be in a particular order otherwise the test case doesn't make any sense. 

We have to clone these test cases for other projects and after cloning the sub tasks are not in the right order. The idea behind getting the order of the sub tasks would be to add that information to a custom field so I'm able to use that field to list them in JQL in the correct order. Then when it's cloned it would be correct.

Thank you in advance

Alex.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events