Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Count Words in a multi-line Custom Text Field Edited

Hi All,

I am trying to return a count of all of the words in a multi-line text field using a "Calculated Text Field". Is there an in-built function to do this? The ".length" function returns the character count for the contents of the custom field. ".size" does not appear to work on the same custom field. 

If there is not an in built way to do this, I was trying to loop through each character in the field looking for ' ' or '\n' which would indicate a new word, however this is error prone e.g. newlines appended to the end of the text. 

Appreciate any guidance.


1 answer


Not sure what version of JIRA you are using and what add-ons you have installed, but as far as I know, this isn't possible out of the box.  We've done a similar thing using the ScriptRunner add-on.  We simply created a Script Field and have the following code in it:

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObjectByName('fieldName')
String cFieldValue = issue.getCustomFieldValue(cField)

if(cFieldValue) {
return cFieldValue.split().size()

return 0

Hope this helps.

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you