ScriptRunner "create a sub-task" script does not set default values for custom fields


  • We want to make it easy for the JIRA users to create sub-tasks;
  • A lot of the information from the parent task needs to be duplicated into the sub-task;
  • We have created self-transitions in specific workflows that just creates a sub-task using ScriptRunner;


  • Jira v6.3.9;
  • ScriptRunner v3.1.4;
  • We have defined a custom field called "VDD";
  • VDD is configured with a default value, which is different for each JIRA project we have. This default value is configured through Administration -> Issues -> Field Configurations;
  • Note: VDD is a field that is only available on sub-tasks. It is not available on the parent task (this is configured through JIRA's Field Configurations)

How ScriptRunner is used:

  • In the Post Functions of the self-transition, we add a Script Post-Function, and use the "create a sub-task" script.
  • The "create sub-task" script is copying the information from the parent task to the sub-task, so this meets our requirement. It even copies the information from custom fields shared by both parent and sub-task (like the Tempo Account field).
  • The script is ordered to run just before "Fire a Generic Event event that can be processed by the listeners."


  • The sub-task is created, and field values are copied (yay!).
  • Problem: The VDD custom field is empty! - it does not use the configuration set for the custom field, associated with the project.
  • If I simply create a sub-task using the JIRA "Create Sub-Task" command, then the VDD custom field has the default value set properly, as per what was configured in Admin->Field Configurations.

Additional notes:

2 answers

1 accepted

I think this is more of a problem with the API. The default values appear on the screen when you are creating an issue, but if you use the API to create an issue, even if you provide no value for that field, it doesn't appear to use the default value configured in the field config scheme. Also seems related to

I think you will have to duplicate the logic to set the CF in the additional actions section.

I could be wrong, I haven't tried to reproduce.

Thanks Jamie, will look for a work around. I am thinking of either copying the field from another "template" issue in the project, or pulling on some content from Confluence. Will have to look at this later on though.

If you find a workaround before I do, please post. I hit the same thing today.

Hi Eric , 

Were you able to find a solution for this ?  Please let me know "how to create a subtask"  automatically using groovy can be achieved .

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,234 views 5 10
Read article

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