Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,657
Community Members
 
Community Events
165
Community Groups

Iterator script for Duedate JMWE on multiple issue creation

Hello, Atlassian Community.

I am using JMWE to create a templated release task set. 

I want to have the user specify the 'duedate' for a release, and then have all of the corresponding sub-tasks automatically created with their appropriate due dates based on the original due date selected. 

I've simplified it below, but I am running into issues trying to calculate a changed due date, I know my script is way off, but I'm looking for a step in the right direction as I came up dry trying to find similar scenarios online.

Screen Shot 2022-06-17 at 3.36.30 PM.png

1 answer

1 accepted

0 votes
Answer accepted

Hi @Dillon ,

if I understand correctly, each sub-task will have a due date that is calculated relative to the due date of the main issue.

One way of achieving this is to calculate the sub-task due date based on an "offset" you'll specify in the iterator. For example, the iterator could be:

[
{summary:"summary", duedateOffset: -14}
]

and the value for the Due date field will be:

{{ issue.fields.duedate | date('add', it.duedateOffset , "d") | date("yyyy-MM-DD") }}

Hi, @David Fischer _Appfire_ - Thank you very much for taking the time to reply and offer a solution. This sounds like it will work exactly as I require, I'm just having difficulties getting the formatting down pat. Excuse my lack of knowledge.

Copy/Pasting your examples above result in (X) on the Groovy Script editor, I tweaked it a bit to get past that - based off of formatting in: https://innovalog.atlassian.net/wiki/spaces/JMWE/pages/1223884853/Advanced+configuration+and+usage+of+the+Create+issue+post-function#Build-an-iterator-to-create-multiple-issues-and-set-fields-of-the-newly-created-issues 

I know it must have something to do with the 'duedate' field, but I can't quite pinpoint what, heres how it looks currently for me.

Screen Shot 2022-06-21 at 1.23.18 PM.png

Upon trying to get the post function to trigger, I get the error message below.

We can't create this issue for you right now, it could be due to unsupported content you've entered into one or more of the issue fields.

I am using Jira Server 8.20.1 and JMWE 7.3.0

Thank you again!

Hi @Dillon ,

my bad, for some unfathomable reason I provided the answer for Jira Cloud.

For Jira Server/DC, the iterator will be:

[
[summary:"summary", duedateOffset: -14]
]

and the value for the Due date field will be:

issue.get("duedate") + it.duedateOffset

Sorry about that,

David

Thank you very much, @David Fischer _Appfire_ - That worked perfectly!

The duedate field looks much more sensible now, thank you for clearing that up - we appreciate the help here greatly, this will work in a number of situations for us.

Best regards,

Dillon

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

123 views 2 5
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