Is there a limit on how many contexts can be set for a custom field ?

Dimitri Cools May 19, 2022

Is there a limit on how many contexts can be set for a custom field ?

https://support.atlassian.com/jira-cloud-administration/docs/add-a-context-to-a-custom-field/

 

In our usecase we need to automatically set a value to a field based on a particular project, eg.

Field XXX = 'aaa' when an issue is created in project 'PROJAAA'

Field XXX = 'bbb' when an issue is created in project 'PROJBBB'

 

So maybe there 's an alternative solution ?

 

thx !

2 answers

1 vote
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 19, 2022

Hi Dimitri,

You don't use a context for that. Contexts are used to show a field or hide a field based on the context, not to populate it. 

But you can use an Automation Rule to do what you want. Here is more information on Automation if you are not familiar with it.

There are two types of automation:

  • Global: In the Free version, you get 100 executions per product, per month
  • Project: In all versions, you get unlimited executions per month

Automation Basics: https://www.atlassian.com/software/jira/guides/expand-jira/automation

You can do this via global rules to apply to all projects also. You'll need to be a Jira Admin/Site Admin, go to Jira Settings > System > Automation Rules (left-hand menu).

For more on using Automation For Jira see these help pages.

Jira Automation Template Library to help get you started quickly:

https://www.atlassian.com/software/jira/automation-template-library#/labels/all/customLabelId/1453

Dimitri Cools May 23, 2022

Hi,

THanks for your suggestion, I did look into that but couldn't make it work for my usecase.

First of all, the value to be inserted depends on the project, so there should be mapping somwehere. I didn't found an easy way to do (& maintain) this, besides creating a bunch of IFs.

Secondly, this is a mandatory field, from what I can experience, the automation fails on this as the automation happens onthe Create event.

 

So unless there's a solution for these, I cannot use automation.

 

(ps. this should have been way easier with a simple groovy script in scriptrunner and an external (db) table )

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 23, 2022

You should be able to just substrting the key value up to the dash (-) and use the project key value to insert into the field. You won't need a bunch of IF statements for that - just one rule. 

Dimitri Cools May 23, 2022

That's the thing, the value to be inserted is not the project key but a corresponding value from a hashmap/array.

Maybe my simple usecase example was not clear enough

Field XXX = 'PPPPPPPP' when an issue is created in project 'PROJAAA'

Field XXX = 'GGGGGG' when an issue is created in project 'PROJBBB'

 

Map: {PROJAAA=PPPPPPPP, PROJBBB=GGGGGG}

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 23, 2022

OH, those are different values for Field XXX that what you showed in the initial example. That would indeed be several IF statements. 

Dimitri Cools May 23, 2022

yes, sorry about that, I guess I oversimplified my example.

Yes, so many IF's is not possible .. thanks for your suggestion though.

That's why - for now- my ugly workaround is to set a context per Project and assign a default value to the field manually :-/ 

I'll continue to see whether I cannot use a scripted field instead.

Like John Funk likes this
0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 19, 2022

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events