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

Check if linked issues contain EXACT summary match

Chris Rosendorf July 10, 2024

Hello, I am using the Automation Rules in Jira Cloud, and trying to solve a "classic": "if issue with summary does not exist, create it".

I have made an automation down to the point where I have these following things available to me:

1) A list of linked issues: {{lookupIssues}}.

2) A {{summaryName}} variable.

 

I now would like to know how to go about checking if the linked issues list contains an EXACT MATCH of the {{summaryName}} variable.

 

Using the: "summary ~ "\"{{summaryName}}\"" does not provide an exact match, as I have other issues that might contain the summaryName, but also include more.

(E.g. TEST-7 has the summary: "Test Issue", TEST-8 has the summary: "Test Issue2")

 

I have already tried branching for each of the {{lookupIssues}}, and checking:

```
If: Compare two values
{{lookupIssue.summary}}
equals
{{summaryName}}
```

But I am unsure how to continue, because I need to exhaust the checking of the list, before I know if the summary is an exact match, and thus continue.
(I tried setting a variable value if a match was found, but seems like it isn't available after the branching scope? Or perhaps I am using it wrong)

 

P.S I am surprised that a text field (Summary) does not allow the '=' operator to check for exact matches.

2 answers

0 votes
Rilwan Ahmed
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 10, 2024

Hi @Chris Rosendorf ,

Welcome to the community !!

Unfortunately at present jira does not support "=" for text search. There is already a feature request and you can vote and watch for the updates.

https://jira.atlassian.com/browse/JRACLOUD-81881

Chris Rosendorf July 10, 2024

Thank you, I think this is a pretty core feature that's missing, and one that doesn't seem very difficult to actually implement...

Regardless, I've accepted that it doesn't exist, but just want to find a work-around that's available to me. I saw that a work-around is utilising ScriptRunner, can I do this in the Jira Cloud Automation environment, and if so, could you perhaps help me with it?

issueFunction in issueFieldExactMatch(subquery, fieldName, regularExpression)


issueFunction in issueFieldExactMatch("issue in linkedIssues({{triggerIssue.id}})", "summary","^{{summaryName}}$")

Would something like that work? And can I just write that, or do I need to be under a ScriptRunner tab, for it to work?

Like John Funk likes this
Rilwan Ahmed
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 10, 2024

Hi @Chris Rosendorf ,

You need to have the scriptrunner plugin installed in your jira.

Syntax

issueFieldExactMatch (subquery, fieldname, regexp)

Example:
issueFunction in issueFieldExactMatch("project = ABCD", "summary", "Test")

Official documentation is in https://docs.adaptavist.com/sr4js/latest/features/jql-functions/included-jql-functions/match-functions

Like John Funk likes this
Chris Rosendorf July 10, 2024

We have ScriptRunner for Jira, I can see it in the "Apps" tab, "ScriptRunner Enhanced Search" and "ScriptRunner for Jira", as well as some other apps unrelated to this.

I can't seem to use the issueFunction in issueFieldExactMatch, though:

There was an error executing a search during custom value definition:
Field 'issueFunction' does not exist or you do not have permission to view it.

Perhaps you could give me a hint as to where to enable it? :)

Just to re-iterate, I am on Jira Cloud, given that, is it still possible?

Like John Funk likes this
0 votes
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.
July 10, 2024

Hi Chris - Welcome to the Atlassian Community!

What trigger are you using to kickoff the rule? 

Chris Rosendorf July 10, 2024

I am using a:

When: Value changes for Description

 

To start the process, because that's when I need to check through and start the rule.

Does this impact the way I can search through the linked issues?

Like John Funk likes this
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.
July 10, 2024

Maybe try doing a Branch for Linked Issues (instead of lookupIssues), then under the branch this:

If: Compare two values
{{triggerIssue.summary}}
equals
{{issue.summary}}

Chris Rosendorf July 10, 2024

I need to ensure that NONE of the linked issues matches the summary, and I can't say that index 0 didn't match the summary, so create the issue, but then the 3rd index in the list is an exact match. Also it would create duplicates, if it loops through the linked issues and just checks that.

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.
July 10, 2024

So you have issues A, B, C linked to Issue D.  The description for issue D changes, issue A is a match on the summary but B and C do not. What are you wanting to happen? 

Chris Rosendorf July 10, 2024

For that example: Nothing.

When a {{summaryName}} is NOT an exact match for a summary of an issue in the list of linked issues (A, B, C) then create it - (The creation part I've already got working)

I just want to ensure I don't make duplicates of everything every time something is changed.

Like John Funk likes this
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.
July 10, 2024

Can you share a screenshot of your rule?

Chris Rosendorf July 12, 2024

It's a bit too big to post a screenshot of, and I don't think that will provide much more value than the description I wrote.

Main thing is: "Create an issue with X summary, if summary with X does not exist".

I have a list of linked issues, so I know what to check through.

I have the summaryName in a variable, so I know what search term I am looking for.


All I need is the comparison of if {{summaryName}} is not an exact match for an issue's summary in the lookupIssues' list. Which is really hard to do, without an = operator.

So to recap what I then tried:

For: branch from linkedIssues

And I can now use a field comparison for "summary equals {{summaryName}}", but if I can't edit a variable, nor access a created variable outside of the branch scope, those also do not give me a way to check if the summary exists in the list by looping through it in a branch.

Perhaps you have a good idea to solve this?

Like John Funk likes this
Bill Sheboy
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.
July 12, 2024

Hi @Chris Rosendorf 

When you have a very long rule to post, you can try a browser addon or separate app to capture the image with the page scrolling.

Back to your question...and without seeing your rule for context...

Rather than branching over the issues you could try:

  • use a lookup issues action with JQL to gather them, 
  • create a variable to represent a regular expression to search for your target Summary value
  • use the inline iteration with the match() function to identify if any existing issues have the same summary, and then decide your actions
{{lookupIssues.summary.match(varYourSearchExpression)}}

 

Kind regards,
Bill

Like John Funk likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events