Hi everyone,
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.
Many thanks!
This works like a charm, dont forget to change the fields ids:
import com.atlassian.jira.component.ComponentAccessor
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)
Good morning Abdulkarim,
Thank you for the suggestion.
I need the control to be done in a transmission through a validation function. Could you tell me where I insert or apply the source code ? or if it requires a special plugin ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.