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

Automate Fields value selection

Hi All,

Can we automate fields value selection depends on other field value using script runner?

Ex - We have custom fields 1, 2, & 3. all are single select list fields

When user selects a field value of 1, field value of 2 and 3 should automatically select depends on the field value of 1.

I am new to script runner.

Thanks in advance,


1 answer

Hi Manikanta,

It is possible using behavior ScriptRunner. The below code should give you a rough idea:

* List A has value 1,2
* List B has value ABC, DEF
* Purpose: Auto-populate List B from value List A

import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Level
import org.apache.log4j.Logger


final def listA = "List A"
final def listB = "List B"

def listFieldA = getFieldByName(listA)
def field = getFieldByName(listB)
def optionsManager = ComponentAccessor.getOptionsManager()

def listFieldB = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName(listB)
def listFieldBConfig = listFieldB.getRelevantConfig(getIssueContext())

def optListFieldB = optionsManager.getOptions(listFieldBConfig)
def optValueA = optListFieldB.find {it.value == "ABC"}
def optValueB = optListFieldB.find {it.value == "DEF"}

def listFieldAValue = listFieldA.getValue()

if(listFieldAValue == "1") {
log.debug("Condition passed! Update to value ABC")

} else if (listFieldAValue == "2") {
log.debug("Condition passed! Update to value DEF")

} else {
log.debug("Condition failed! Update to null")

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Jira Cloud Performance Improvements

Hello everyone, I am a product manager in the Jira Cloud team focused on making sure our customers have a delightful experience using our products. Towards that goal, one of the areas which is extr...

146 views 1 8
Read article

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