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
4,294,588
Community Members
 
Community Events
165
Community Groups

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

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 M Funk Community Leader 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

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 M Funk Community Leader 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. 

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 M Funk Community Leader 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. 

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 M Funk likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,225 views 35 44
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