Iterator script for Duedate JMWE on multiple issue creation

Dillon June 17, 2022

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
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 17, 2022

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") }}
Dillon June 21, 2022

Hi, @David Fischer - 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!

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 21, 2022

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

Dillon June 21, 2022

Thank you very much, @David Fischer - 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