Pregunta

I have realized a workflow, which use several status, and between them transitions (with associated screens sometimes in order to specify further informations).
In one transition, I have a screen a field called InitialDate.
Later, I have an other screen, which contains the following :
- a field called FinalDate
- a duration

In the validator of that last transition, I would like to evaluate the number of working days, between InitialDate and FinalDate, according to the JIRA time-tracking configuration.
Then, I would like to compare this result with the duration field. If it is equal then transition is ran, otherwhise, an error message will appear...and transition will be not executed.

Thanks a lot,

Christophe

Here is a piece of code I began to write ... but not complete :-(

Date FirstDate = new Date(cfValues['InitialDate'].getTime())
Date LastDate = new Date(cfValues['FinalDate'].getTime())
long elapsedtime = (FirstDate.getTime() - LastDate.getTime() ) / 86400000
int nbdays = elapsedtime.intvalue()
boolean res = nbdays= cfValues['duration']

¿Fue útil?

Solución

I am not sure if you are looking for the actual code or would like advice on a route to go/plugin to use. I would use the Script Validator in the Transition. The Script Validator can be found in the

It allows you to add your code and display a message if the validation fails i.e you return false. The code for this would be pretty straight forward Java

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top