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

How do I set JIRA up to re-open a task and change the due date automatically?

I'm in the process of making a project that will track all of our maintenance requests and TPM for our shop floor. For TPM, Total Preventative Maintenance, we have set tasks that need to be done every month, quarterly, semi-annual, or annually. 

What I would like to do is have JIRA automatically  re-open (re-schedule) a task once maintenance has marked it as complete. It would then need to change the due date based on the previous due date, or when it was completed (one or the other, we wouldn't use both methods at the same time). 

Are there any plugins that can already do this? If not, any ideas on how I could accomplish it?

3 answers

I used Scriptrunner plugin for a similar requirement:automatically create repeating task/subtask depending on a frequency (monthly, quarterly, etc.) and setting due dates accordingly.

Basically we used the escalation service to transition issue through a transition with some scripted postfunctions where all the logic (create subtask, calculate due date) was taking place.

I had not much experience in scripting as well, but got some help by colleagues and examples posted in this forum.



Do you have any links, or can you share the script that you run in the post-function?

 That is the script we use in Create Subtask postfunction. It does some additional things as well.

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.CustomFieldType
import com.atlassian.jira.issue.fields.CustomField
import java.sql.Timestamp;
Calendar calendar = Calendar.getInstance();
Calendar calendarP = Calendar.getInstance();
def Integer days = 0
def Integer daysP = 0
    days = 3
    daysP =6 }
    days = 7
    daysP =13 }
    days = 15
    daysP =30 }
    days = 61
    daysP =91}
    days = 121
    daysP =181}
    days = 275
    daysP =365}
    days = 550
    daysP =730}
    days = 915
    daysP =1095}
calendar.add(Calendar.DAY_OF_MONTH, days);
calendarP.add(Calendar.DAY_OF_MONTH, daysP);
Timestamp mydueDate = new Timestamp(calendar.getTimeInMillis());
Timestamp myPDate = new Timestamp(calendarP.getTimeInMillis());
def eid = customFieldManager.getCustomFieldObjects(issue).
    find { == 'External issue ID'}
def ped = customFieldManager.getCustomFieldObjects(issue).
    find { == 'Planned End Date'}
def psd = customFieldManager.getCustomFieldObjects(issue).
    find { == 'Planned Start Date'}
issue.setCustomFieldValue(ped, myPDate)
transientVars["issue"].setCustomFieldValue(ped, myPDate)
//allow no links to be copied to subtask
checkLink = {link -> false};
//set external issue id to null on subtask
issue.setCustomFieldValue(eid, null)
issue.setCustomFieldValue(psd, mydueDate)
transientVars["issue"].setCustomFieldValue(psd, mydueDate)
issue.summary =  myPDate.format("MM.yyyy")+ ': ' +  

@Udo Brand,

Awesome! Thanks for posting it!

I'm going to try the Scheduler plugin first, but will go your route if that doesn't fit our needs.

There's the Scheduler plugin that does something similar to that. It doesn't reopen the same task, because that wouldn't be trackable as metrics, but it creates new ones on scheduled dates.

If you would rather have the re-scheduling done not on fixed dates, but in relation to the time the issue was moved to the Done status for instance, then you need to do some post-function voodoo with the help of scripts or some plugin(s). Issue Templates would let you set a special post-function that would create an issue in the transition to Done.

But if it was for me, i'd get the scheduler plugin solution. It's reasonably priced and sounds like a good thing to have in other JIRA processes as well. 

I had looked at that one briefly, but I'll give it another try. I'm not well versed on creating "complex" scripts, so I'd like to stay away from them for now.

Thanks for the suggestion!

Why dont you update your workflow so that when maintenance completes the task, the destination step becomes Open.

That should solve your issue.


How would I have it change the due date automatically? There are too many tasks to have someone manually edit the due date every time.

@alexlwilson  It has been quite a long time, but we are currently trying to do something similar and I would like to know what worked better for you. Thanks!

@Noa Diaz 

In the end, we accomplished this by using Automate Lite for Jira (now owned by Atlassian and built into Jira Cloud) to reopen the tickets every day at 12am and created a post-function during that transition to increment the due date field based on a dropdown field on the ticket that assigned the frequency  (Week, Month, etc.). We used the Jira Workflow Toolbox plugin and created the below setting using the "Update parameters of the Set a field as a function of other fields Function for this transition" post-function:


(Weekly){00012} + {WEEK}
(Bi-weekly){00012} + 2 * {WEEK}
(Monthly){00012} + {MONTH}
(Quarterly){00012} + 4 * {MONTH}
(Semi-annually){00012} + 6 * {MONTH}
(Annually){00012} + 12 * {MONTH}

Suggest an answer

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

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

471 views 3 7
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