Forums

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

Issue linking

lrodriguez March 28, 2022

Hello,

I am trying to establish a link between the newly created ticket to a preexisting one that exactly matches the newly created issue's summary.

I am able to get the preexisting issue(s) by using an "if" block before the "link issues" component that matches the summary, however, 

It seems the Rule is failing with the below details:

Please help.

 

Link issues
Error rendering smart-values when executing this rule:
Failed to get value for issue.summary.match(“([A-Z]+-\d+)”): {{issue.summary.match(“([A-Z]+-\d+)”)}

1 answer

1 accepted

1 vote
Answer accepted
Mark Segall
Community Champion
March 28, 2022

Hi @lrodriguez and welcome to the community!

It looks to me like your regex is trying to find where the summary contains an issue key in it.  From what you're trying to achieve, I think you want something like this:

2022-03-28_08-04-26.png

lrodriguez March 28, 2022

Hi Mark, thank you for your prompt reply.

My issue is more specifically related to the linking portion. The error I am getting is coming from trying to link the newly created issue back to the preexisting one:

Screen Shot 2022-03-28 at 10.34.19 AM.png

lrodriguez March 28, 2022

Even if I try to "Link the issue to the trigger issue", the preexisting bug doesn't update the linking portion, and the audit log doesn't display any errors

Mark Segall
Community Champion
March 28, 2022

It may be possible to do it the way you're trying to do it, but the main issue I see with your current approach is that your regex is against the issue summary and assumes your summary contains issue key(s).  I don't think that's your intent.  You would need to instead do something like this:

{{lookupIssues.match("([A-Z]+-\d+)}}

But again, this will likely cause you fits if you have more than 1 matching issue because lookupIssues will provide the result set in an array and you'll need to iterate through the array with some kind of advanced branching.

The approach I shared is just looking at this from the opposite perspective... Rather than trying to link your new issue to a potential list of similar issues, branch into each of the matching issues and link them to your new issue.

Like Bill Sheboy likes this
lrodriguez March 28, 2022

Thank you for simplifying the approach.

In essence, I am trying to create a rule that triggers upon an issue being created.

More specifically, If the newly created issue's summary equals any preexisting issue(s), then set the newly created ticket's status to "Rejected", and link it to any preexisting ones (without modifying the preexisting one's status).

Is there a straightforward example you could share?

Many thanks.

Mark Segall
Community Champion
March 28, 2022

Thanks for the additional context.  I understand why you need to perform the lookup issues action.  Give this a try:

2022-03-28_14-57-55.png

Quick explanation....

  1. Checks whether there are other issues with the same summary using this JQL:
    1. summary ~ "{{issue.summary}}" AND key != {{issue}}
  2. Then performs a validation to make sure the results are greater than 0
  3. If that passes, then it branches into each issue and links to the current issue
  4. Then transitions (I don't have a rejected status in my environment so I just used Done)
lrodriguez March 29, 2022

Screen Shot 2022-03-29 at 8.30.35 AM.png

Thank you Mark. It seems the query is still having issues.

Please advise.

Mark Segall
Community Champion
March 29, 2022

Can you please show me the latest screenshot of your rule?

lrodriguez March 29, 2022

Here it is. Thanks:

Screen Shot 2022-03-29 at 8.56.59 AM.png

Mark Segall
Community Champion
March 29, 2022

Your syntax looks good.  The only thing I can think of is that you maybe need to do some quote escapes.  What happens if you try this:

summary ~ "\"{{summary}}\"" AND key != {{issue}}
lrodriguez March 29, 2022

Thanks again Mark. It seems the rule is not failing anymore, but it's not quite achieving its purpose. The newly created ticket did not get past the lookup issue JQL query.  For testing purposes, I have a preexisting identical ticket open for triggering this rule, but it seems it wasn't able to get there.Screen Shot 2022-03-29 at 9.53.37 AM.png

Mark Segall
Community Champion
March 29, 2022

I just noticed that your advanced condition has a space.  It should be this:

 

{{lookupIssues.size}}

Greater than

0

lrodriguez March 29, 2022

It Works!

Thank you Mark for your patience and help on this matter.

Like Mark Segall likes this

Suggest an answer

Log in or Sign up to answer