query for text field length

Bryan Collick January 2, 2018

Would it be possible to query for any issues where, say, description is empty OR has a length less than X?

We've discovered that in certain exceptional situations, users have bypassed required text fields by entering "." or "tbd" or something similar. Since the forcing function of a required field has introduced bad behavior, I'd like to instead create a filter to identify empty or incomplete fields so that I can reach out and prevent them from remaining in that state. 

Instance in question is self-hosted(aws), JIRA Software server 7.4.2.

2 answers

1 accepted

3 votes
Answer accepted
Ignacio Pulgar
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 2, 2018

Jira Query Language doesn't support that kind of text search natively.

However, ScriptRunner provides a search function that supports regular expressions, so maybe the following query returns all issues from FOO project with a description of less than 10 characters:

issueFunction in issueFieldMatch("project = FOO", "description", "^.{0,10}$")

Alternative methods at your disposal are:

  1. export the issues with the fields you would like to analyze to a CSV file and use external functions from a spreadsheet or text editor
  2. query JIRA API to get the desired issues with the fields of your interest and code a custom solution which iterates over the results
  3. query the database directly (which, generally speaking, this is a bad practice) and use a character length function provided by the underlying DBMS

Hope it helps.

1 vote
Casey Gould March 30, 2023

For anyone (like me) still looking for this functionality (please?) several years later, it's one of the things you can hack your way around with Jira Automation and smart values, which do support text field length comparisons. No plugins required. I talk about this workaround process for date comparisons as a answer to this question.

 

For example, I have a comment that runs when an action is performed include the following line:

{{#if(issue.Description.length.lte(400))}}*Description seems a little short*.{{/}}

The key here is that {{issue.Description.length}} is something you can access and work from within the automation, which you could set to trigger on an action or schedule to run against a query of issues.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events