Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

scriptrunner > create a subtask > time tracking

Michael Furtmeier
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 1, 2023

Hello together,

I use Scriptrunner to automatically create a subtask when creating a task.

For the subtask, a predefined time estimate should now be stored ("Original Estimate").

Is it possible to set a fixed number of hours for all subtasks created under the task?

I have already found the option to predefine a custom field

def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'MyCustomFieldType'}
issue.setCustomFieldValue(cf, 'my value')

However, the time tracking is not a custom field and probably does not work because of this.

Can someone please help me?
Greetings Michael

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -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 1, 2023

Welcome to the Atlassian Community!

Your guess is exactly right - time tracking is not a custom field and you get to system fields differently.  From memory, try issue.setOriginalEstimate() - bear in mind this thinks in seconds, not hours or minutes.

Michael Furtmeier
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 1, 2023

Hello Nic,
Thank you very much for your help.
With this code line it works.
Greetings Michael

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.20.15
TAGS
AUG Leaders

Atlassian Community Events