JQL to search for characters in summary

Pauline Hild
Contributor
January 15, 2023

Hi everyone,

I want to create an automation that prevents a task from being created twice by mistake. For this I need a JQL that searches for 4 characters (numbers or letters) between two underscores in the summary (e.g. _0110_), since these are contained in the summary of each project. If there is already a project that contains exactly these four characters in its summary, the creation of the task should be prevented.
How must the JQL look like for this?

Best regards,

Pauline. 

1 answer

1 vote
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2023

Hi @Pauline Hild 

Jira automation, if you are thinking of implementing your thought with that, it will not be of any use. Jira automation is executed as a post function and not as a validator.

Out of the box you can't search for this, meaning a set of substring located between two other characters (you could use smart values on Jira automation, but again this would not prevent your users for creating a subtask). You will need an app like JMWE, JSU, JWT. Do you have any of that?

Pauline Hild
Contributor
January 15, 2023

Thank you very much for your answer.

Unfortunately I don't have any of the apps you mentioned. How could I make this work with one of the apps? And is there any other way to get at least a hint when creating already existing task?

Vicente Domínguez _Decadis AG_
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.
January 16, 2023

Hello @Pauline Hild and thank you @Alex Koxaras _Relational_for mentioning us!

You could use a Jira expression validator to validate the summary of the newly created issues with an expression similar to the following one:

!issue?.summary.includes("_10011_" || "_10012_")

In this case, the validator will allow the transition only if any of the texts between brackets is not included in the summary of the current issue.

Unfortunately, we are still unable to retrieve the summaries of the projects, so the texts between brackets will need to be hard coded into the expression.

I am part of the Support Team for JWT. Please, do not hesitate to contact us if you have any question regarding JWT Cloud via our Support Service Desk.

Best regards,

Vicente

Pauline Hild
Contributor
January 17, 2023

Hello @Alex Koxaras _Relational_ ,

Thank you so much for responding to my question. If I understood it correctly, I would need to add the letters/numbers from all existing projects into the Jira expression validator to exclude that a project with the same characters is created twice, since matching is not possible automatically?

Beste regards,

Pauline 

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 17, 2023

@Pauline Hild on your question you spoke about issues. Which one is it now? Issues or projects?

Pauline Hild
Contributor
January 18, 2023

Sorry for the terminology confusion, it's about Issues- Tasks, to be precise (each Issue is a separate project, hence the confusion).

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 18, 2023

@Pauline Hild 

For all future created issues you have to add a validator on the create transition of all the issue types to which you want to include this restriction. E.g. If you want not to allow users to create Tasks and Bugs if their summary contains a certain "string", then you have to apply this validator to all separate workflows. If Task and Bug are using the same workflow, then you have to apply to it once.

Pauline Hild
Contributor
January 18, 2023

All right. But again, I need to specify which characters should not be in the summary, since there is no way to automatically match if the same characters are already in a summary?

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 18, 2023

@Pauline Hild sorry but I dont fully understand your requirement. You want to search for issue that contains any number between two underscores (_) and if you find such issue, then don't allow the creation of this issue?

E.g.

  • I try to create a summary which contains " blah blah _1234_  blah blah"
  • The validator searches for any summary that contains "_1234_"
  • If a result is return, then the issue can't be created
  • Now your user try to create another issue with summary " _2222_  blah blah blah"
  • The validator runs and can't find any issue with summary that contains "_2222_"
  • The issue is allowed

Is the above correct?

Pauline Hild
Contributor
January 18, 2023

Yes, exactly.

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 18, 2023

@Pauline Hild 

From further search I did unfortunately I have bad news for you concerning at least my proposed solution: It seems that it's not possible to validate an issue against others, due to restrictions from Jira (to get a bit more technical you have to use only jira expressions and you can't use REST API to retrieve a collection of issues, against which you will run your jira expression).

So to get back to your initial query:

Unfortunately you can't prevent an issue of being created via the automation. As I said, the automation runs after the issue being created. So that's the time when the automation will run. Perhaps the only thing you could consider is if you want the user to create the issue, and have an automation deleting it afterwards.. If yes, let me know and I'll try to create this rule for you.

Pauline Hild
Contributor
January 19, 2023

@Alex Koxaras _Relational_ 

Thanks for your efforts up to here to help me out! I am interested in such an automation and would be very happy about help with the creation of the rule.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events