ScriptRunner Behaviour, automatically update field value based on another custom field

During issue creation, we make a custom field required, Regression Issue, in our JIRA workflow.  It's only required during creation.  We wanted to only force the requirement on new issues, not force all the previously created issues to update this field during edit.  Currently, we have a ScriptRunner Behaviors script to make other custom fields visible and/or required when certain values are select in the "Regression Issue" field. 

The problem arises with our SalesForce integration.  When users create new issues using the remote API.  The Regression Issue field doesn't register as required custom field. 

As a workaround, I was hoping to take advantage of the Behaviour script again to recognize a specific custom field, SalesForce ID, that's set during creation.  If a value is added (any value), then set "Regression Issue" select list to "No".  However, I can't seem to get this to happen.  I've also tried using certain user group as a criteria, but that's a no go too.

Is it possible to automatically force a field value change based on another field not being empty?  I've included my current Behavior script.


import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

def regressionIssueField = getFieldById(getFieldChanged())
def regressedVersionField = getFieldByName("Regressed from Version(s)")
def regressedBuildField = getFieldByName("Regressed from Build #")
def salesforceField = getFieldById(getFieldChanged())

String regressionIssueValue = regressionIssueField.getValue()
String salesforceValue = salesforceField.getValue()

if (salesforceValue) {

if (regressionIssueValue == "Yes") {
} else {


Thanks, Chuck

1 answer

2 votes

Unfortunately if your creating the issue through the REST API the behaviours are not applied. That is one of the limitations of behaviours explained here.

Your probably best off using a validator to make the field required which will still be applied when creating the issue via the REST API. If you want further customisation over the requiredness of the field you should consider writing a scripted validator.

OK.  I suspected that might be the case.  Thanks for confirming! 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 2 hours ago in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

13 views 0 3
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you