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

Require custom field based on Component/s field using Scriptrunner Behavior Edited

I would like to require a text field (or a single-select dropdown) based on the value selected in the Component/s field. (The custom fields are Acceptance Criteria and Code review required?)

I have:

  • created a behavior
  • mapped the behavior to a project and issue type
  • selected a workflow from the Guide Workflow dropdown
  • added the Component/s field
  • added a condition: Workflow Action: Create
  • added a server-side script:
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

def componentField = getFieldByName("Component/s")
def acceptanceCriteriaField = getFieldByName("Acceptance Criteria")

String componentValue = componentField.getValue()

if (componentValue == "AI Platform") {

else {

 I am unable to make this work and could use some advice.

1 answer

Hello Robbie,

I think the issue is that component/s is an array, and so a direct "==" comparison won't work.

Try something like this:


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.project.component.ProjectComponent

def componentField = getFieldById("components")
def acceptanceCriteriaField = getFieldByName("Acceptance Criteria")

def componentValue = componentField.getValue() as List<ProjectComponent>
if (componentValue.any { == "AI Platform"} ) {


else {


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