Hello,
I'm trying to create an automation rule which check if an existing project component name is in the issue summary.
I'm quite new to the Jira Automation system and this is my rule :
1- Webhook : GET all components from rest/api/2/project/{{project.key}}/components
2- If : Advanced compare condition : {{webResponse.body.name.split(", ")}} contains {{issue.summary}}
Then return "1" in the log
Else : Return "0" in the log
The only time the rule worked was when i've put only the exact component name in it. If multiple words are in the summary the condition doesn't work even if a component name exists.
Thanks already for your help on that :)
Best regards
To clarify, are you trying to determine if the issue Summary contains any of the current Components configured for the project?
If so, I think you could...use an advanced compare condition by parsing the components into a regular expression. For example:
That second value will produce a regular expression with the list of components, such as this:
(myComponentA|myComponentB)
Kind regards,
Bill
Hello Bill,
Thanks you, it's working well !
I've added those conversions to avoid lower or upper case issues :
{{issue.summary.toLowerCase()}}
({{#webResponse.body.name.toLowerCase()}}{{.}}{{^last}}|{{/}}{{/}})
Thanks you again for your help.
Best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well done!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy my usecase is quite similar to the one of @Yohan Brunet
The only difference is that I would search for a variable String which starts with a predefined String in this case "TEST-" followed by a integer value which is flexible. What I want to find out if there a similar issues existing, containing this String anywhere in the summary.
The background is that we use it to control our test cases and I would like to find out if there are duplicates because the cases are created by an adjacent system.
I tried it with the following query but the match method doesn't seem to be the right one for this usecase.
Currently I am receiving the following error:
Maybe you got an idea how to solve this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tobias
Three things to try/consider...
a) Are you just trying to get the numeric value after that string? If so, please try this expression:
{{issue.summary.match("TEST-(\d+)")}}
b) Might there be multiple results in your summary? If so, consider how you want to proceed, as that regEx will only return the first one found. If you want them all, you need to use a split() first, allowing the match() to iterate over the split substrings.
c) The documentation for the match() function says the "underlying implementation is based on Java's Pattern class", and so I recommend using the simplest expression which can solve your need, and to then test thoroughly.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
a) We are searching for potential duplicate issues which match a newly created issue which contains the String "TEST-123" - similar to an issue key for example. The integer value should be configured in the query as a flexible length, because we dont want to review the rule every month.
b) Good point. That would be our next step after checking only the first one, which would be enough for now.
What is currently not clear is how to implement point a when it comes to the comparison of the summary of existing issues. I just don't know how to set it up. I am not sure how to adress the summary of existing issues as an comparison.
Best regards,
Tobias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are using Jira Cloud, you may use the Lookup Issues action to do that:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
unfortunately, we only use the server version. Is there also a solution for this via Automation for Jira?
We don't have the option to use lookupIssues. It would be helpful to find a solution for checking only the first value, because this would be a criteria for us to link it to the existing one. Hope that my usecase is clearer now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First thing, I am using Jira Cloud. And so I cannot test this...
For Server/Data Center, I believe the equivalent is to use the bulk-processing option with either the scheduled trigger or branches, as described here: https://confluence.atlassian.com/automation/run-a-rule-against-issues-in-bulk-993924653.html
With that option the {{issues}} smart value becomes available and should work like {{lookupIssues}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.