Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to update the "Priority" field based another single choice custom field Value in jira.


Hi Team,

  I did not find the solution in our community and tried with behaviors also. We have field "Escalation?". If we change the "Escalation?" to Yes, the priority should change to Critical (after ticket creation).  I tried below code behaviors, but still not updating when we changed Escalation is yes. Could you please help me on this.


def escalationfield = getFieldByName("Escalation?")
def prio = getFieldByName("Priority")

if (escalationfield.getValue() == "Yes")



2 answers

1 accepted

0 votes
Answer accepted
Leo Community Leader Feb 13, 2020

Hi @Lakshmi S,

Below is the script for behaviour, I tested in project too

Note: you should use "Escalation"  field as source field & mapped to it

if (getFieldById(getFieldChanged()).getValue() == "Yes") {

And below script used for the same but in Script Listener

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParametersImpl
import com.atlassian.jira.issue.Issue

def issue = event.issue as Issue
def constantsManager = ComponentAccessor.getConstantsManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getUser()
def issueService = ComponentAccessor.getIssueService()
def issueInputParameters = new IssueInputParametersImpl()

def cfField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Custom Field Name")
def value = issue.getCustomFieldValue(cfField)
if(value == "Value 1"){
}else if(value == "Value 2"){

def validationResult = issueService.validateUpdate(user,, issueInputParameters)

if (validationResult.isValid()) {
issueService.update(user, validationResult)
} else {
log.warn validationResult.errorCollection.errors


Hope it gives you  some idea



Perfect. This is working as expected. Thank you @Leo 


if (getFieldById(getFieldChanged()).getValue() == "Yes") {

Hi @Leo Leo,

We have same scenario but diff custom field

If user select the value "minor" from impact custom field and "likely" from the probability custom field automatically priority must set to "medium"


Will this possible to achieve in behavior

Waiting for the your reply



Leo Community Leader Apr 08, 2020

Hi @balaji,

I would say YES. that is possible

As I mentioned above you'll have to map/write this behaviour with your custom field(Impact) and then the same script in server side script

if (getFieldById(getFieldChanged()).getValue() == "Minor") {




hi @Leo 

Thanks for your reply,

As i mentioned above there are two fields called impact and probablity

based on the value priority system fields should change ,


Is that possible ?

Leo Community Leader Apr 09, 2020


you can map behaviour with single field which will be executed when the associated field changed/updated

Of course you can validate 2 field values in priority, but the drawback is below

1. If you map with 1st field, the script will be executed only when 1st field changed. if you change your 2nd field after 1st one. the validation will fail and priority will not be applied

The same goes for if you map with 2nd one.

If you really want to go with behaviour, you'll have write 2, and map each one with each field but with same script(I won't suggest that personally)

In this situation you can consider custom listener. where you can map with your project with issue created & updated event. here you can validate both fields values and update priority

you can refer my listener script above 




Hi @Leo , I know this is a bit old but I came across this and it might help me. But I was wondering would this work if the custom field is a single choice list?

Would you need to add the name of the field and the choice or would it just be the choice alone?

if (getFieldById(getFieldChanged()).getValue() == "Cyber Incident Categorisation - Account Compromise") {

I tried both ways but it did not seem to update accordingly.

Any help would be appreciated.


When trying to set priority value on create screen a warning pops up:

These fields have default values for this project and issue type combination. We have preserved the existing values in case you need them.

Priority: 1

Suggest an answer

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

Confluence: Where work and wellness meet

Feeling overwhelmed by the demands of work and life? With a 25% increase in the prevalence of anxiety and depression worldwide during the pandemic, for most of us, it’s a resounding yes . 🙋‍♀️ ...

1,013 views 17 27
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