Forums

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

JMWE - Create a ticket and automatically create the sub task ticket according to custom fields

kuanleong.choong May 25, 2025

Hi, 
I would like to create a ticket (parent ticket - PAR-xxx) and automatically create sub task tickets whereby the project key would based on the custom fields with multiple selection (custom field called "project": PJ1, PJ2, PJ3).
Then the sub tasks ticket creation would be PJ1-xxx, PJ2-xxx, PJ3-xxx.
Herewith my scripting, not sure which part was gone wrong.
I gotten the errors message to say: No Project found with the key "PJ1, PJ2, PJ3".
*Note:
I tried the project key in automation rule creation, it worked. 
Kindly advise and assist.
Thanks.

Create Issue 1.jpg
Create issue 2.jpg
Create Issue 3.jpg

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
David Fischer
Community Champion
May 25, 2025

Hi @kuanleong.choong 

The iterator should actually be the value of your multi-select custom field, and the calculated project should be:

{{it.value}}

This way, one subtask will be created per selected value of the"project" custom field.  

kuanleong.choong May 25, 2025

Thanks David and I'm truly appreciated your replies.
*I'm not really a tech guy but I am learning now.

Mind to ask does that mean the scripting for project and the iterator also put {{it.value}} will do?
Actually I tried multiple ways as per your advise.
1. I remained the scripting for project calculated, the iterator I replace with {{it.value}}, with and without the iterator return JSON check box. - No errors and no sub task being created as well.
2. Replace {{it.value}} in both places (project calculated and iterator) - no errors and no sub task being created as well.
3. Modify the project calculated scripting a little bit and put {{it.value}} in iterator - no errors and no sub task being as created as well.

Mind to share more about your insights.
Thanks.




David Fischer
Community Champion
May 26, 2025

Hi @kuanleong.choong 

The iterator script is supposed to return a list of values over which the post function will iterate to create one subtask per value. In your case, since you want to create one subtask per value selected on your checkbox custom field, the iterator should be:

{{issue.fields.customfield_10050 | join("value",",") }}

 which will create a list of the text value of each selected option.

Then for the "calculated project" setting, use this:

{{it}}

 which will return the current value of the iterator. However, this will only work if the checkbox values are project keys, not project names.  

Finally, this post function will only create the subtasks. The main issue must first be created with another Create Issues post function, and both post post functions must be placed in a Sequence of Post Functions post function. 

I believe there is such an example in the documentation for the Create Issues post function. 

kuanleong.choong May 28, 2025

Thanks David. It worked now.

David Fischer
Community Champion
May 28, 2025

You're welcome. 

Can you "accept" the answer so that others can benefit from it?

Thanks

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events