Default value of custom field is not set during creation (field is not present on create issue screen), how to set it?

Thomas Heidenreich
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.
May 20, 2012

Hello,

I have a custom field which has to be set to a default value without giving the user access to change the field content. Simply defining a default value doesn't work - the field stays empty. Is there any easy way the get the field set?

(This has only to be done for one projects, in all other projects users are allowed to change the field, so it is present on the create issue screen there)

Thanks in advance!

2 answers

1 accepted

0 votes
Answer accepted
Thomas Heidenreich
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.
September 26, 2012

It is not possible the way I thought, a field that is to be set at issue creation must always be present on the create issue screen.

0 votes
Ramiro Pointis
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.
May 20, 2012

You can do a post-function of the Create step where sets the value field. I don't remember if that's a by default action on Jira or it is part of this plugin:

https://plugins.atlassian.com/plugins/com.innovalog.jmwe.jira-misc-workflow-extensions

Thomas Heidenreich
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.
May 20, 2012

Sadly there is no post action to set a custom field - and especially not one which depends on the context/project for the default value.

Ramiro Pointis
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.
May 20, 2012

I have this Post-Function 'Update Issue Custom Field', with this I do that, but I'm trying to remember if this was from a Plugin and what plugin...

Ramiro Pointis
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.
May 20, 2012

Jira Suite Utilities that's the plugin that has the Post-Function 'Update Issue Custom Field'.

Ramiro Pointis
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.
May 20, 2012

Other workaround would be using the Script Runner plugin. And create a Script Post-Function that assigns the value to the custom field. It is pretty easy to do and I think this would be the script:

def cf = "customfield_xxxx"

def fieldname = customFieldManager.setCustomFieldObject('X Value')

Suggest an answer

Log in or Sign up to answer