Forums

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

linkedissues function with just single key parameter in Automation passing two parameters

Henry Yei
Contributor
October 16, 2020 edited

I am trying to use the linkedissues() function within a Jira Automation, but I am getting an unexpected error.

The following JQL query works fine in an advanced search:

issue = PROJ-154 AND issue in linkedissues(PROJ-155)

With the automation with a JQL match If condition where issueToLink is an issue found in the comments.

issue = {{issue.key}} AND issue in linkedissues({{issueToLink}})

I get the error:

No subsequent actions were performed since JQL condition did not pass due to error running JQL:"(key IN (PROJ-164) AND (issue = PROJ-164 AND issue in linkedissues(PROJ-154, PROJ-154)))" - Issue link type 'PROJ-154' could not be found in function 'linkedIssues'.

 

I want to match all linked tickets. If I use issue = {{issue.key}} AND issue in linkedissues({{issueToLink}}, "relates to"), it works fine, but I want to match any linked tickets that match the key.

 

Is this a Jira automation bug, or am I using it wrong?

 

Note: 

It looks like a bug might have been introduced on 9/20/2020, as linkedissues function worked in automation with a single parameter for me earlier that day and started failing past 9PM PST that day, unless someone changed the trigger on me.

I'd previously thought I successfully tested and rolled out a trigger using this query:

https://community.atlassian.com/t5/Jira-Software-questions/Jira-automation-restrict-linking-issue-rule-from-adding/qaq-p/1465593#M95060

2 answers

2 accepted

1 vote
Answer accepted
Henry Yei
Contributor
October 27, 2020

Turns out that when match() returns a collection, the smartvalue shows up a comma separated list. The confusion stemmed from the fact that the error only appeared when the user pasted a full on link into the comments (where issueToLink was attempting to look for issue keys). This introduced smartlink tags that didn't show up in the rest api and wasn't obvious in the JIRA UI, only if comment.body was printed out as a smartvalue. The regex was matching PROJ-154 twice from the comment text 

[https://mycompany.atlassian.net/browse/PROJ-154|https://mycompany.atlassian.net/browse/PROJ-154|smart-link]

The fix to my issue was to handle both cases where issueToLink may be a string such as PROJ-154 or a string or a comma separated list of values, where I split and take the first match.

0 votes
Answer accepted
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 19, 2020

Hi Henry,

Yes, I think I remember that bug of only one parameter being allowed. So you could do an if then and list each of the issue link types as a separate action - assuming there are not too many. 

Henry Yei
Contributor
October 19, 2020 edited

There are 11 different link types.. I will open up a support case.

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 19, 2020

Maybe @Simmo can answer that.

Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 26, 2020

Hi folks,

I don't know much at all about this function since its a Jira specific thing. However, looking at the error message:

Issue link type 'PROJ-154' could not be found in function 'linkedIssues'.

I think the issue might be with your param. Why is issueToLink smart value providing the same value twice? In your example you only had it once. I'd start with that and see if that helps.

Henry Yei
Contributor
October 26, 2020

I troubleshooted with support and the smart value was properly set. However while we were adding logs, the issue stopped manifesting. The fact the error message was telling me that that my key was being passed in twice with a comma in between to simulate two params made no sense based on the code that created the issueToLink variable.

Suggest an answer

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

Atlassian Community Events