Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Transition Most Recently Updated Subtask on Parent Transition

Mathew Lederman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2023

We are looking to use Project Automation to reopen the most recently closed sub-task when the Parent transitions from Resolved > In Progress. 

To identify the most recently updated sub-task, I'm using "issue in limitedResults("Project=[ProjName]","1") ORDER BY updated DESC" from the Go! JQL add-on, but I can't figure out how to apply the transition to the resulting subtask. Below is what we've built to-date:

IssueTransitioned.png

Any suggestions would be appreciated

1 answer

0 votes
Florian Bonniec
Community Champion
May 30, 2023

Hi @Mathew Lederman 

 

If I'm not mistaken, the second condition return all the issue from the project but limit the number of result to 1, returning the lat updated issue of the project.

It do not seems to be what you are looking for.

You are looking for something more like project = RQMTEST and parent = {{triggerIssue.key}} if it support that.

 

Regards

Mathew Lederman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2023

This worked perfectly, thanks! I updated the If: Issue matches JQL to the following:

issue in limitedResults("parent = {{triggerIssue.key}}","1") ORDER BY updated DESC

Is there a reason (possibly best practice?) to include the project in the query? I tested with and without and didn't notice a difference in the time taken to complete the automation. 

Florian Bonniec
Community Champion
May 30, 2023

Not sure, in this case parent field is already limiting the scope to the project the trigger issue is in.

Mathew Lederman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 1, 2023

After some testing the query above didn't quite work as desired. Because the ORDER BY function occurs after the limtedResults function and not simultaneously, the query always returns the same result. We have tried to put the ORDER BY function in the limitedResults function, but the automation fails which works in a simple JQL search. However, when moved into the automation with the Smart Value it fails.

We updated the query to 

issue in limitedResults("parent = ({{triggerIssue.key}}) ORDER BY updated DESC","1") 

And the automation returns the following error:

(key IN (RQMTEST-174) AND (issue in limitedResults("parent = (RQMTEST-171)))" - Error in the JQL Query: The quoted string 'parent = (RQMTEST-171)))' has not been completed. (line 1, character 52)

 Any suggestions?

Florian Bonniec
Community Champion
June 1, 2023

Not sure if it's the cause of the issue but the JQL is not valid

issue in limitedResults("parent = ({{triggerIssue.key}}) ORDER BY updated DESC","1") 

 It should be 

issue in limitedResults("parent = {{triggerIssue.key}} ORDER BY updated DESC","1") 

() are not supported after =

 

Reagdrs 

Mathew Lederman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 1, 2023

Apologies, you're right, I was testing to see if the ( ) would fix the error, but it did not. Removing them also does not fix. I'm still getting this error:

"(key IN (RQMTEST-174) AND (issue in limitedResults("parent = RQMTEST-171))" - Error in the JQL Query: The quoted string 'parent = RQMTEST-171))' has not been completed. (line 1, character 52)
Florian Bonniec
Community Champion
June 1, 2023

Weird what is the JQL with the smartvalue and an example of what it's translated into ?

Because in the error message there is a missing " 

"(key IN (RQMTEST-174) AND (issue in limitedResults("parent = RQMTEST-171))"

 A " should be after the issue key  RQMTEST-171

 

Regards

Mathew Lederman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 1, 2023

That's how I'm reading it as well. I tried adding a single quote separately before and after the smart value with no luck.

This works perfectly fine in the advanced search JQL and returns one row, RQM-174, which is the correct row.

issue in limitedResults("parent = RQMTEST-171 ORDER BY updated DESC","1")

I'm working with RQMTEST-171, where RQMTEST-172 through RQMTEST-177 are subtasks and RQMTEST-174 is the last updated.

But when I move the exact same string pre-identifying the parent task instead of using the smart value, I get a different set of errors that makes even less sense than the prior:

RQMTEST-171: "(((parent = RQMTEST-171) AND (issue in limitedResults("parent = RQMTEST-171)) AND (key != RQMTEST-171)) AND (project in (25700))" - Error in the JQL Query: The quoted string 'parent = RQMTEST-171)) AND (key != RQMTEST-171)) AND (project in (25700))' has not been completed. (line 1, character 55)
Florian Bonniec
Community Champion
June 1, 2023

Weird have you try to use ' instead " or escape the " using \" ?

Mathew Lederman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 1, 2023

I tried ' instead of " but didn't see any changes. 

After reading into the error a bit more, I see that it's trying to end the limitedResults("","") function immediately following the {{triggerissue.key}} at the first space rather than at the double quotes. I've tried to build a layered call, but since it's so simple it just isn't working. I even duplicated the initial request in the query to determine if it was the space that was causing the issue. It's not, the function is trying to end before ORDER BY 

issue in limitedResults("parent = {{triggerissue.key}} AND parent = {{triggerissue.key}} ORDER BY updated DESC", "1")

returns this:

(key IN (RQMTEST-174) AND (issue in limitedResults("parent = RQMTEST-171 AND parent = RQMTEST-171))" - Error in the JQL Query: The quoted string 'parent = RQMTEST-171 AND parent = RQMTEST-171))' has not been completed. (line 1, character 52)

No idea why it's doing that.

I'm not familiar with the \ escape character. Can you suggest how I would use it? Tried a few things and couldn't get it to work properly in the advanced search. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.20.11
TAGS
AUG Leaders

Atlassian Community Events