Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Compare releaseDate with custom field date and execute transition

denizkaradal May 18, 2020

Hi all,

I have a requirement in our project. The transition must set based on the comparison of two date fields and either it should be transioned to "X" status or "Y" status. Those comparison is being made between the "release date" in Fix Version/s and a custom date field. I added two post functions on the transiton which points itself again.

The case:

After the user clicks the transition button which points itself on the issue, an additional screen pops up and asks for a date on a custom field. By using "Transition issues by JWT" post function on a conditional execution

I supllied such information: 

%{0074} > {01234} (First post function)

%{0074} < {01234} (second post function)

The problem arises no matter which date I choose on the pop-up screen, only it is being set for example into first post function statement not the second one. 

2 answers

2 accepted

2 votes
Answer accepted
Thorsten Letschert _Decadis AG_
Atlassian Partner
May 18, 2020

Hi @denizkaradal ,

In order to use the actual release date, please use an expression like this (assuming an issue only has one fix version):

first(releaseDates(%{00074})) > {01234}

The field code itself that you have used only returns the version name.

Cheers
Thorsten

0 votes
Answer accepted
denizkaradal May 18, 2020

Hi @Thorsten Letschert _Decadis AG_ 

That made it work. As you pointed out, the issue might have more than one fix versions. How can I achieve to check them all then?

Regards

Deniz

Thorsten Letschert _Decadis AG_
Atlassian Partner
May 18, 2020

Hi @denizkaradal ,

Of couse you can check against multiple versions as well, e.g.

max(releaseDates(%{00074}))

returns the largest date and

min(releaseDates(%{00074}))

returns the lowest date.

Cheers
Thorsten

denizkaradal May 18, 2020

@Thorsten Letschert _Decadis AG_ 

Thanks for the valuable feedback so far. As far as I am concerned, your suggestion brings only the maximum date or minumum date in this case. Am I right?

What I want to achieve in this case like this:  If several "Releases" are listed under "Fixed Versions" on the issue, the date which I entered should be compared with all linked releases from released date. 

i.e I have two released dates which are "30.05.2020" and "30.06.2020".

  • If I ever give the date on custom field "18.05.2020", it fullfills the requirement and shoud be transioned to status "X" because it is before released dates
  • In contrary, if I ever give date as "05.06.2020", that does not fulfill the requirement because one release date is before my entered date. Therefore it should be transioned to status "Y".

hope it is clear what I want to achieve now.

Thorsten Letschert _Decadis AG_
Atlassian Partner
May 18, 2020

Hi @denizkaradal ,

Thanks for the feedback.

However, your solution should be there already then:

The expression

{01234} < min(releaseDates(%{00074}))

should transition to status x - if your custom date is lower than the lowest release date it's lower than all release dates.

The expression 

{01234} > min(releaseDates(%{00074}))

should then transition to status y - if your custom date is larger than the lowest release date there is at least one release date lower than your custom date.

denizkaradal May 18, 2020

Hi @Thorsten Letschert _Decadis AG_ 

Lastly which documentation should I take into account for a future reference in order to accomplish such case?

Thorsten Letschert _Decadis AG_
Atlassian Partner
May 18, 2020

Hi @denizkaradal ,

The complete list of functions (extended by various examples) can be found here: https://apps.decadis.net/display/JWT/Expression+Parser

denizkaradal May 19, 2020

Hi @Thorsten Letschert _Decadis AG_ 

I realized a strange behaviour from a condition. As you know I have a transition which points itself along with those 2 post functions we set it up. So far so good.

I have another two transitions which point to either status "X" or status "Y". so I set on both two transitions "Hide a transition from user" function from "Conditions" tab. The idea was to let the user see only the transition button which brings that pop-up window. 

but after applying those conditions, the post functions does not function anymore. Have any idea or is this a bug?

denizkaradal May 19, 2020

Hi @Thorsten Letschert _Decadis AG_ 

I found the solution by using "Transition is triggered by Jira Workflow Toolbox post-function" so problem has been solved. Only status name will not be updated automatically on view screen after post-function has been set. You need to refresh the page and it shows up the right one. Is there a solution for it or expected behaviour?

Suggest an answer

Log in or Sign up to answer