How can I do a fuzzy search on the built-in custom URL field

Michelle Player June 26, 2017

Hi there...hoping someone can share some tips or insight.

I'm unable to search with the 'like' ~ operator for a URL type field.  The URL validation works but I'd like to search for all bugs related to specific countries, where each country has set of URLs across various environments like development, test, staging, and production.  

For example: I want to see all bugs reported for France where the URL is like "http*fr*".

Everything I've read indicates this isn't possible.  Only =, !=, in, not in, is, is not, are valid operators.  But I'm hoping there is a creative workaround or way to change the URL custom field type without losing the content already entered.  Note - I'm not a developer and am unfamiliar with writing or using things like Script Runner.

2 answers

0 votes
Ilari Nikula February 23, 2023

Hi Michelle,

 

Have you tried using Automation and Smart values to do this?

You could try creating an automation that extracts the country from the URL-field and then pastes that value to another field called, e.g. Country. Then you could simply filter issues by the Country-field.

To do this you need to create an automation with with following variable (which contains the smart value):
Variable name: ExtractCountry
Smart value: {{issue.cf[Field ID].text.substringBetween("[what ever is in the URL before the country string]","[what ever comes after the country string]")}}

(replace the bolded text with your own values)

The automation could be something like this:
1. When: Issue created
2. URL field is not empty
3. Then: Create variable
     - ExtractCountry
     - {{issue.cf[Field ID].text.substringBetween("[nn]","[nn]")}}
4. And: Edit issue fields: Country
    - Paste the variable as the field value: {{ExtractCountry}}
5. And: Add value to the audit log
    - This is optional but helps when trying to get the automation to work

You can also set the trigger to be run manually at first when you are testing the automation and once you get it working, you can run it when a new issue is created.

Hopefully this works for you.

0 votes
somethingblue
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 26, 2017

Hi Michelle,

Since that's not possible in JQL, the first thing I would do is attempt to query the data using the API and search the results.

Barring any additonal advice, another option would be to perform a SQL search, however, it's not recommended to manipulate the db directly as it can lead to issues if something goes awry.  In light of that, here is the JIRA Database Schema.

You can use the JIRA Database Schema to write a SQL query to find the data you need:

  • The jiraissue table holds the issues
  • The customfield table holds a list of the custom fields
  • The individual instances of a custom field are held in the customfieldvalue table and the value is in the stringvalue column.

You can also find the custom field id using the article How to find id for custom field(s)?

Once you have the custom field you or your dba should be able to construct a query to find the issues based on the custom field.

In addition,

Cheers,

Branden

Michelle Player June 26, 2017

Thank you...I will give it a try.

Suggest an answer

Log in or Sign up to answer