Groovy script to check due date in is the future

Matt July 30, 2015

I am using "Update parameters of the Set Field Value from Parent Function for this transition." post function  and i want to use the Conditional execution: (Only if condition is true Only execute this post-function if the following Groovy expression returns true) I want to check if the due date is either today or in the future. 
Does anyone have a idea how to do this?  

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Peter Bengov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 2, 2015

Hi Matt, try using the following sample code. duedays will return then number days left, so as long as this parameter is positive - you haven't reached the due date. Once it's negative - ticket has crossed the due date.

int duedays = (issue.getDueDate().time - new Date().getTime()) / 86400000
Matt August 2, 2015

Hi Peter, Many thanks smile 

0 votes
Robert Dzido
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 30, 2015

I can recommend using Workflow PowerBox plugin (but it's paid one). It contains "Condition Based Post Function". Take it and use "Universal Data/Time Condition" as a condition and your post function. It's not a solution with groovy expression but can be usable.

TAGS
AUG Leaders

Atlassian Community Events