Can JIRA Workflow status change based on past due date ?

We customized jira workflow to meet our end user requirement. We have Transition(id) “Submit To Assignee” .

When we create any issue status will be in “draft”. And when we create any issue we have option to select “Due Date” .

“Due Date” Can be current date , future date and Past date.

When we select any created “issue” then there is option/button to “ Submit to Assignee”.

When we click on “Submit to Assignee” button ,issue status changed to “In Progress” .

Currently we have written jelly script , that will run at every 12 hours and changes issue status to “Overdue” for “In Progress “ issues based on current date and past date.

Our customer looking while clicking on “Submit to Assignee” button ,issue status should be based on “Due Date” for example see below conditions

a. On Click “Submit to Assignee”

1. Check “Due Date” , if it is past due date change issue status to “Overdue” immediately

2. Check “Due Date” , if it is current/future date change issue status to “In Progress” immediately

Please help us to achieve this functionality either by custom changes in workflow or any straight forward plugin allow us to achieve it.

Please provide your valuable solution or guidance or plugin details , but that should fix our problem.

2 answers

Hi Tukaram,

This issue could be fixed with transition validators. You can add multiple transitions from one status going to different statusses and by adding a validator to each transition, you can guarantee that only one transition is followed. Make sure that all validators are exclusive, meaning that only one validator will return true. With a Date Expression Compare validator you can compare a date field (due date) to another date, f.e the current time. You will probly have to do something like

Create 2 transitions:

a) Transition 1 has a date expression compare validator that checks for: duedate < now. This transition will go to the Overdue status.

b) Transition 2 has a date expression compare validator that checks for: duedate >= now. This transition will go to the In Progress status.

By using < and >= in different validators you guarantee that each transition is exclusive.

Hope this helps!

Thanks for your input .

We are looking at very begining state only , i mean when we click on "Create" button issues should be created either Draft or Overdue based on due date.

Please provide your suggestion

Hi Tukaram,

Unfortunately, it is not possible to have multiple 'create' transitions. I would suggest you have a look at script runner plugin:

the https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner

This plugin adds some post transition functions that allow you to execute some scripts. A very interesting one is the ' Fast-track transition an issue'. This lets you take a certain transition, based on a condition of one of your fields.

First of all you can create the 2 transitions from my previous comment and let them start from the open status. Next you can add a post function 'Fast-track transition an issue' to the create transition that checks for the duedate. If it is smaller then the current time, you let your workflow take the transition that goes to the Overdue status. Otherwise you let the script take the normal route.

Is this explanation clear for you?

Hi Tukaram,

Unfortunately, it is not possible to have multiple 'create' transitions. I would suggest you have a look at script runner plugin:

the https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner

This plugin adds some post transition functions that allow you to execute some scripts. A very interesting one is the ' Fast-track transition an issue'. This lets you take a certain transition, based on a condition of one of your fields.

First of all you can create the 2 transitions from my previous comment and let them start from the open status. Next you can add a post function 'Fast-track transition an issue' to the create transition that checks for the duedate. If it is smaller then the current time, you let your workflow take the transition that goes to the Overdue status. Otherwise you let the script take the normal route.

Is this explanation clear for you?

Thanks for your suggestion and time. We are using jira version 6.1.5 , Scriprt runner which support JIRA 6.1.5 may not have all feature

Thanks Benji for help and support .

I tried solution which you suggested , some how it looks to solve issue .

I need to validate condition for due date and current date but i'm not able to do it . I tried following it didn't work

Condition : duedate < currentLogin()

Could you have any idea how use dates in condition for scrpit runner "Fast-track transition an issue'

Hi Tukaram,

I came up with a solution that should normally fix your issue. As a test case I modified the standard issue workflow and added an Overdue state with its own transition:

You have do complete the following steps:

1) Install all necessary plugins (both are free):

a) Script runner plugin

b) JIRA Suite Utilities

2) Add a condition to the 'Go in Overdue' transition that hides it in the UI. This setting make sure that the 'Go in Overdue' button is not visible as a transition button in the issue. The condition is simply called Hide transition.

3) Add a validator to the 'Go in Overdue' transition that guarantees that this transition can not be taken if the duedate is not in the past. Add a Date Expression Compare validator that checks wether the due date field is smaller then now.

5) Add a post function to the 'Create Issue' transition and the one you need is called Script Post Function. On the next screen select Fast-track transition an issue. As a condition use the following code snippet:

issue.dueDate.compareTo(new Date()) &lt; 0

This tests wether the duedate is in the past. As an action select the 'Go in Overdue' transition.

This is all you need to do to make your workflow go to the overdue status when the user selects a duedate in the past on issue creation. If the new worflow state is not immediately visible, you can always refresh you browser and then it should be updated correctly.

Hope this helps!

One small remark: Make sure that the script post function from step 5 is placed after the re-indexing and event post-functions.

Hi Benji,

Thanks for your support and time. I Installed both plugins ( JIRA Suite Utilities and Script Runner) . When i try to configure step 2 above mentioned , i was not able to find "Hide transition" , could you tell me from where i can get it .

Hi Tukaram,

I forgot to mention 1 plugin:

https://marketplace.atlassian.com/plugins/com.innovalog.jmwe.jira-misc-workflow-extensions

Installing this plugin adds the 'hide transition' condition I mentioned in step 2.

Once again thanks.

What i observed is , when i create a past due date issue manually it's created with Overdue status and looks good but when i do CSV file import with past due date issues , it showing only last issue status overdue and all other issues in open only . But when i click on any issue then status is overdue and again if search issue it showing Open only. Could you have any idea about this behaviour

Which plugin are you using to export to csv?

Can you try to do the same with xml (without using any plugins) and see if you have the same issues?

Benji, We are using as follows steps for bulk load/import

System->External System Import ->Import from Comma-separated values(CSV)

Hi Tukaram,

I think this thread starts to deviate to much from the original question. Can you please continue this discussion in another thread that tackles the import issue?

please some one could share your thoughts here

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,169 views 13 19
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot