ScriptRunner: custom field with different options by project

Hi.

Is it possible with Adaptavist ScriptRunner to have different option lists by project on a select list custom field?

 

The objective is to have just one custom field with custom options by project to avoid having one custom field for each project.

Example:

Project A

  • Option 1
  • Option 2
  • Option 3

Project B

  • Option 4
  • Option 5
  • Option 6

 

Thank you.

1 answer

This widget could not be displayed.

Hi Carlos,

This is definitely achievable. You can do this in one of two ways:

1. Add an additional context (native JIRA). Create one custom select field, when you click "Configure" on the options menu, you can select to "Add a new context" from that field. Contexts can be restricted to specific project, thus you can configure various options for given projects. This option is a native JIRA feature that would only require one field (as per your requirement).

The only drawback to this approach is if you have a lot of common options, and lots of different projects, you can end up with lots of duplication. In that circumstance, it is better to use ScriptRunner Behaviors (see option 2 below).

2. Use an initialiser in behaviors. This would require one custom select field, with one context and one set of options. You would then put in a custom script that would check the project and determine which options to show them. You can find out how to do this, by looking at our example for setting system field defaults (https://scriptrunner.adaptavist.com/latest/jira/recipes/behaviours/setting-default-fields.html#_setting_system_field_defaults)

I hope this helps!

Steve

Hi Carlos,

Did this answer resolve your issue? Are you still having trouble with this?

Steve

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...

146 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