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

Hi,

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

Thanks

1 answer

1 accepted

This widget could not be displayed.

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
   {
       fgroup.setFormValue("jira-administrators")
   } else if (vtype =="3") 
   // 3 - issue type id for  Task
   {
       fgroup.setFormValue("jira-developers")
   } else if (vtype =="4") 
   // 4 - issue type id for Improvement
   {  
       fgroup.setFormValue("jira-users")
}

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

Regards,
Florjan

Hi Vidic,

Thank you for your answer.

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

Thanks

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.

Regards,
Florjan

(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: https://jamieechlin.atlassian.net/wiki/display/JBHV/JIRA%20Behaviours%20Plugin#JIRABehavioursPlugin-Installation)

Hi Florjan,

Works flawlessly!

Thanks a lot

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

165 views 2 0
Join discussion

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