On this page

Example: Validation based on the value of a date type project property

Actually I've a validation in a transaction based on a projectProperty. The validation is this: 

 %{11312} >= projectProperty("finifacturacion") 

Where %{11312} is a selection date custom field and in the project I've defined the property: {finifacturacion=01/01/2015}

I would like to use the value of this property in the validation message. How can I do that? I have tried the following string but it does not work: 

No es posible modificar los datos de facturación. La fecha tope para hacerlo era el  + projectProperty("finifacturacion").

I have included parser function stringToDate(string_date, timezone). This function returns the numeric value for string containing a date-time value for a certain timezone. To implement your validation you should use Boolean validator with math, date-time or text-string terms with the following configuration:

Boolean expression used is: {11500} >= stringToDate(projectProperty("finifacturacion"), LOCAL)

Note that:

  • {11500} is code for numeric value of certain Date Picker or Date-Time Picker custom field. This field code depends on each particular Jira instance.
  • In this example I have used timezone LOCAL, since I suppose that the literal date-time value in project property finifacturacion should be interpreted in Jira server's local timezone configuration.
  • Valid string date-time formats for project properties are: yyyy/MM/dd HH:mmyyyy-MM-dd HH:mmyyyy/MM/dd and yyyy-MM-dd, also formats relative to current time like in JQL queries: "w" (weeks), "d" (days), "h" (hours) or "m" (minutes), or format defined at property system jira.date.time.picker.java.format. In your particular case, you should write your project property like this: {finifacturacion=2015/01/01}

Other examples of that function

Related Usage Examples