HOw to search for issue where custom field contains part of a string ?

Calderara Serge June 16, 2022

Dear all,

I have a custom field which is a list box field of text.

When user create a ticket he select from that list box the proper item

What I need to do from an Automation rul is to check as a condition that :

IF my_CustomField contains "ABC", then I should do an Action

Typically, all the follwing value of my field should return true :

my_CustomField = 123-ABC9993383

my_CustomField = ABC9993383 

my_CustomField = 9993383ABC

 

What is the proper syntax to build that rule JQL condition ?

I have tried the following :

my_CustomField ~"*ABC* which should cover all case

But when I test this in search issue query, I have an error saying that "*" are not supported.

 

What is the proper way to do this search ?

regards

2 answers

0 votes
mauricio.groth
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.
June 17, 2022

Hi @Calderara Serge 

As you're on Jira Cloud, the correct answer is to get an app that provides JQL extensions you're looking for.


With standard JQL, you can only get a list of issues and export them to Excel for further processing. This works if you want to do a one-off analysis. If your use case is more dynamic than that, look beyond standard Jira.

Standard JQL doesn't easily allow it, but you can quickly find the results using our professional indexing service JQL Search Extensions

 

You can use this query to filter your issues where a custom field contains part of a string

 

issue in wildcardMatch("my_CustomField", "ABC*")

 

The star symbol can be placed anywhere in the text – you can even place more than one.

 

Check out the documentation for more examples.
I hope this helps!
Maurício

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 16, 2022

You can't do this search.

The whole point of a select list is that you have a fixed range of items with clear, uniquely identifiable options.  There's no need to be able to search for part of the name of an option in these fields.  The desire to do so indicates that you've not defined your usage of the field properly.

There is a fix:  

Review your use of the field.  Is it really a select-list?  Your desire to do partial searches suggest that it should probably be a text box, or maybe a combination of fields (for example, a select list for ABC and a text box for the rest of the string, or a cascading select, or a sleect and a numeric field)

There is a kludge:

Create an automation that runs when the field is changed.  Create a text field (not put on the edit screens).  The automation can copy the name of the option selected into the text field.  Then you can use ~ to search the text field.

Calderara Serge June 16, 2022

@Nic Brough -Adaptavist- , thanks for your reply

This is the way my customer is working base on its product Type name and I cannot change their identification

In fact when they have selected the product name in the list for exemple :

123ABCD45678, in fact out of this name, the caracters at position 2,3,4 is the product type group

From an automation IF I need to check this product type ID out of this string in order to populate an other field with the type

For exemple I have define a IF condition in Automation as below

yBD86ZL80f.png

From my rule above, that means if my field contains in 2,3,4 position the string M22, then I will edit an other field in the form and set it to HB2

This works fine for one condition but what I need to to check different value as below

IF {{issue."Charging Station SN".substring(1,4).capitalize()}} EQUAL M22
OR {{issue."Charging Station SN".substring(1,4).capitalize()}} EQUAL M23

THEN myType = HB2

I could not find a proper condition which allows be to implement this in Automation

Any idea ?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 17, 2022

It's the same answer I already gave, either sort out the product identification into sane fields (either split into more fields to avoid the customers silly naming scheme, or turned into a text field because that's how you want to use it).

@mauricio.groth also gives you a solution without having to set your fields up properly.

Suggest an answer

Log in or Sign up to answer