Unable to use lastComment and lastUpdated in the linkedIssuesOf subquery

Stefano D_Angelo November 19, 2021

Hello,

I am trying to write a query to get all the Jira tickets in a first-level project (here PRJ1) that are linked to second-level projects tickets which (these last tickets) were last updated (with a status transition or a comment and so on) more than 3 months ago.

The query I have written so far is:

project = PRJ1 AND status = "Passed to Dev" AND issuetype in (Bug, Incident, Problem, Task) AND issueFunction in linkedIssuesOf("issueFunction in lastComment("before -3M")", "To fix") AND issueFunction in linkedIssueOf("issueFunction in lastUpdated("before -3M"))", "To fix") ORDER BY updated

Nevertheless, Jira informs me that:

Error in the JQL Query: Expecting ')' or ',' but got 'before'. (line 1, character 142)

How can the linkedIssueOf feature be used with lastComment and lastUpdated subqueries? I am aware that the syntax should be:

linkedIssuesOf(Subquery, [link name])

Thanks a lot in advance. 

1 answer

1 vote
Walter Buggenhout
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 19, 2021

Hi @Stefano D_Angelo and welcome to the Community!

Have you tried replacing the double quotes in your lastcomment() or lastupdated() sections with single quotes?

project = PRJ1 AND status = "Passed to Dev" AND issuetype in (Bug, Incident, Problem, Task)
AND issueFunction in linkedIssuesOf("issueFunction in lastComment('before -3M')", "To fix")
AND issueFunction in linkedIssueOf("issueFunction in lastUpdated('before -3M'))", "To fix")
ORDER BY updated

Hope this helps!

Stefano D_Angelo November 23, 2021

Hello @Walter Buggenhout , thank you very much for your fast help!

I have been able to follow your suggestion and modify the Jira query using the single quotes in the lastComment condition (but not in the lastUpdated one - that can be disregarded for now), therefore the query now is:

project = PRJ1 AND status = "Passed to Dev" AND issuetype in (Bug, Incident, Problem, Task) AND issueFunction in linkedIssuesOf("issueFunction in lastComment('before -3M')", "To fix") ORDER BY updated DESC

Nevertheless, although the query is now syntactically correct, the results show PRJ1's tickets linked to 2nd-level projects' tickets whose comments are newer (and not older) than 3 months.

I have already tried also with 'before 3M' or 'after -3M' but still no success.

Is there any chance you can help further?

A thousand thanks again for your support.

Like Antoine Berry likes this
Walter Buggenhout
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 23, 2021

Hi @Stefano D_Angelo,

I hadn't paid much attention to that part of your query, but M for months does not exist as far as I know. You can use "w" for weeks or "d" for days instead. M is used for minutes (although it is normally spelled with a small 'm').

I would replace before -30M  with before -90d. It is not entirely correct, but should come pretty close!

Stefano D_Angelo November 25, 2021

Hello @Walter Buggenhout, I referred to some other documentation where it says 'M' could stand for months but I might have misread it!

Thank you so much, now it works!

One last question (if possible): how could I include all the link types (or at least more than just one) in the linkedIssueOf argument and not just To fix?

Thank you very much.

Like Walter Buggenhout likes this
Walter Buggenhout
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 25, 2021

Hi @Stefano D_Angelo,

If you want to include all link types, you can just omit the "to fix" parameter from the query. However, if you want to retrieve multiple specific link types, you might have to combine multiple issuefuntion in linkedIssuesOf() statements, where you specify the desired link type separately.

If that's the case, then be very careful to use parentheses in the right places for consistent results.

Good luck with that last bit! 

Like Stefano D_Angelo likes this

Suggest an answer

Log in or Sign up to answer