Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pre-populate sub-task fields from parent

Edited

I'm trying to follow an example provided here, to pre-populate sub-task issue fields upon creation (because some of them are required).

However code, as well as description, refres to parentIssueId field which should be present on form. But how does one gets the value of a parent issue ID when sub-task is just being created?

What I'm trying to do is to pre-populate several fields from the parent issue when Create is being called, so the script to appear in Initializer section, without a need to trigger or change anything from end user.

1 answer

You cannot do this. As we specified in the article that you are referencing to:

"This script hinges on the parentIssueId being present in the form. As such, you will need to associate the script with a visible field. It will not work as an initialiser."

You can see this as a warning in the article:

Screen Shot 2018-01-17 at 11.34.32.png

So to solve your issue all you have to do is not use it as an initialiser, since they are loaded before the form is populated.

If this solved your answer, please accept the answer so that other users know that this question has been solved.

May I help you further?

Cheers!

Dyelamos 

But how parentIssueId field is populated with its value? Is it like an internal name which is being auto-populated by JIRA one field with such name appears on a form?

I don't actually know how it works, since that is on JIRA's side. But think of it this way:

When the form is loaded, these things happen.

1. A request is sent.

2. Behaviours load.

3. Behaviours execute initialisers. 

4. Jira loads data into the form. This includes things like the project and such.

5. Rest of behaviours are executed.

6. Behaviours await triggers from the user.

So as you can see, the initialisers are loaded before the data of the server is parsed into the form. The problem is that parentIssueID is populated at step 4. Do you understand what I mean?

If this solved your answer, please accept the answer so that other users know that this question has been solved.

May I help you further?

Cheers!

Dyelamos

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

78 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you