Avoid field inherit during subtask creation

Hello,

 

Context: Jira 7.2.0

Scriptrunner addon

 

I'm using two worflows. One for the ticket and one for subtask creation and management.

When I'm creating a subtask, I have a screen on which I can select a time estimation from a drop down menu with a default value set to 2 hours.

So, first time I create a subtask I have a "Time estimated in hours" field with a default value of 2.

My problem is that, when I create a second subtask, the "Time estimated in hours field" inherits the value I choosed when creating the first subtask.

For example, if while creating first subtask I set up the "Time estimated in hours" field to 6, when I will create a second subtask the default value of the "time estimated in hours" field will be 6 and not 2.

It's really important for my activity that this field value is reset to default when creating a second, or a third subtask.

 

Do you have any idea on how to fix that?

 

Thanks in advance.

 

Germain.

 

 

1 answer

1 accepted

This widget could not be displayed.

Hi Germani.

The creating subtask builtin listener or postfunction has a field called additional issue actions.

You could write something like this:

def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Time estimated in hours'}
issue.setCustomFieldValue(cf, 2)

That way, you will have set your issue value down to your "2" value.

Mind you, this will only work if your custom field is a numeric custom field.

Hope this helped, if you need any more help, please do say, and if this helped, please accept and upvote my answer so that other users can benefit from this question.

Cheers!

Dyelamos

 

Hi Daniel,

 

Yes, it helps! Thank you.

I was expecting a solution that can apply to all kind of fields but in this particular case that's a great solution.

Thanks again.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

564 views 25 15
Join discussion

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