Listener to Convert Custom Text Field to Lowercase

Julia January 25, 2023

I want to create a listener so when a custom field is updated the value is converting to lowercase. 

  • Field 1 is a short text field 
  • When Field 1 is updated with a value like ABC123 
  • Convert the value to abc123 

How can I accomplish this? 

1 answer

1 accepted

1 vote
Answer accepted
Ram Kumar Aravindakshan _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.
January 26, 2023

Hi @Julia

For your requirement, you can try something like this:-

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue

def issue = event.issue as MutableIssue
def customFieldManager = ComponentAccessor.customFieldManager
def issueManager = ComponentAccessor.issueManager
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser

def sampleText = customFieldManager.getCustomFieldObjectsByName('Sample Text').first()
issue.setCustomFieldValue(sampleText, sampleText.getValue(issue).toString().toLowerCase())
issueManager.updateIssue(loggedInUser, issue, EventDispatchOption.DO_NOT_DISPATCH, false)

Please note that the sample working code above is not 100% exact to your environment. Hence, you will need to make the required modifications.

Below is a screenshot of the Listener configuration:-


Since you mentioned in your description that you want this to trigger only when the field is updated, only the IssueUpdate event has been added.

I hope this helps to solve your question. :-)

Thank you and Kind regards,


Julia January 27, 2023

This worked, thank you!! 

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events