How to set the value of a custom field based on Issue Type


I need to set the value of a group picker custom field based on the value in Issue Type. How to accomplish that?


1 answer

1 accepted

2 votes
Accepted answer

Hi Tomas,

You can try this code:

FormField ftype = getFieldById(fieldChanged) 
FormField fgroup = getFieldByName("Group")
String vtype = (String) ftype.getFormValue()

if (vtype =="2") 
   // 2 - issue type id for  New feature
   } else if (vtype =="3") 
   // 3 - issue type id for  Task
   } else if (vtype =="4") 
   // 4 - issue type id for Improvement

Please change your issue type ids and rename name "Group" with your Group picker custom field name.


Hi Vidic,

Thank you for your answer.

Where do I enter this code? I am on JIRA 6.2.2


Hi Tomas,

  1. Go the Administration sceen, select Add-ons tab and click the Behaviours link on the left side of the screen.
  2. You will see Add Behaviour label somewhere in the center of the screen. Add a name of your behaviour in Name field (e.g. My behaviour) and click on Add button to add your behaviour.
  3. Now you will see the name of your behavior on the screen. On the right side is link Fields. Click on it.
  4. In screen with information of your behaviour select Issue Type in Add field field. Confirm entered information by clicking on Add button.
  5. Information about Issue Type field will appear on you screen. Click on Add serverside script link and insert code.
  6. Confirm your code by clicking on Update button at the end of code.


(I have jira v. 6.1.3. I hope that procedure will be similar in your case.
You can find additional information in Behaviours documentation:

Hi Florjan,

Works flawlessly!

Thanks a lot

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,098 views 4 9
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