How can I compare a text field that contains the numerical value of a year (for example "2019") to know if it is greater than a date type field (for example the date of creation of the issue that presents a format dd.mm.yyyy)?
I need to incorporate the condition into a transition.
This works like a charm, dont forget to change the fields ids:
def cfm = ComponentAccessor.getCustomFieldManager()
Date date = (Date)issue.getCustomFieldValue(cfm.getCustomFieldObject("customfield_11100")) // date field id
int dateYear = date.format("yyyy").toInteger()
String year = (String)issue.getCustomFieldValue(cfm.getCustomFieldObject("customfield_10809")) // year field id
int fieldYear = year.toInteger()
return dateYear < fieldYear
This will allow the transition if the year (text field) is greater than the date (date field)
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