How do I populate a custom field with different default values upon create based on issue type

Helge Scheil February 23, 2017

Hi,

The background for my question is: I have created a new issue type called Feature Request. When a feature request gets approved, we are simply moving it to be an epic instead, in the same project.

I want to be able to find all epics who originated from feature requests. The WAS / WAS IN operators are not support for the issueType field so I am out of luck on that front.

I therefore was thinking about adding a custom field called "featureRequest" for all issue types and default it to "true" when a feature request is created and default it to "false" when any other issue type is created. Upon moving the feature request to a different issue type, that featureRequest field value would be moved and I can query any issue type based on featureRequest=true.

My question: Without using add-ons such as ScriptRunner, what options do I have to implement this defaulting behavior? 

I tried field schemes, field configuration schemes, etc - no luck.

Or is there even a different way of querying an issue based on what prior issueType it once was?

Any advice?

Thanks, Helge

3 answers

5 votes
Jon Bevan [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2017

Hi Helge,

You can use ScriptRunner for JIRA Cloud and write a Post Function for the create transition that will set the value of a custom field to whatever you need it to be.

A starting point is this example which adds two custom field values together, but you can change it to just set a custom field based on the issue type: http://scriptrunner-docs.connect.adaptavist.com/jiracloud/post-functions.html#_calculated_custom_field

Let me know if you need more help,

Jon

0 votes
John Slaman August 13, 2018

I've not done this; and a tad surprised by the statement: "I tried field schemes, field configuration schemes, etc - no luck."

 

You can create custom fields, for each custom field you can create multiple configuration context(s).  Each configuration context can be associated with different projects, issues types and default values.  

So, you should be able to create a custom field with a configuration context and default value of true when your issue type is "Feature Request"; and a default value of false for all other issue types.

See https://community.atlassian.com/t5/Jira-questions/How-do-I-pre-populate-text-to-a-description-field-on-JIRA-Cloud/qaq-p/456606 for a tad more information. 

0 votes
Joe Pitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 24, 2017

I would think when you move the issue it would take along the value for the field and overwrite  the default. Have you tried that?

Suggest an answer

Log in or Sign up to answer