Make post-function work after screen fields update

Sergey Shmarkatyuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2013

I have resolution screen with 'log work' fields (time spent, remaining estimate), which appears on the 'Resolve' transition. Also I have added post-function to 'Resolve' transition setting remaining estimate to 0h. But the problem is that post-function works before log work fields values are stored into database. More specifically, remaining estimate is updated automatically based on 'original estimate' and 'time spent' values after it was flushed by post-function.

Is there a way to make my post-function work after resolution screen fields update?

Edit: here is the screenshot of post-functions ordering:

5 answers

1 accepted

1 vote
Answer accepted
Sergey Shmarkatyuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

It turns out that I needed to use 'Set Field Value' post-function (choose 'Remaining Estimate' field and '0h' as a value) instead of 'Clear Field Value' post-function in order to reset remaining estimate on resolution.

0 votes
Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

Try adding the Store issue post function after each of the 2 postfunction you have added to purge the fields

Sergey Shmarkatyuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

I do not have 'Store issue' post-function at the list of post-functions in my JIRA. Do I need to install some plugin in order to make it avilable?

0 votes
Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

Hm, maybe is a question of the tool used to do this ...

Try this one:https://marketplace.atlassian.com/plugins/com.keplerrominfo.jira.plugins.jjupin

create a post function, put it at the end, edit it and just write as the postfunction body:

estimate = "0h"

That should do the trick.

Sergey Shmarkatyuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

it worked. but I'm not sure I can persuade management to buy jjupin (even though it is not that expensive) plugin only for the minor task of remaining estimate reset just because JiraCannotDoItOutOfTheBox ... :(

Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

yeah, I know. But isn't it funny .... :)

0 votes
MatthewC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2013

I think you're trying to do too much in the one step. The data submitted as part of the form, doesn't get saved until the end. So if you have apost function which finds the issue, it's probably pulling data from the database (which hasn't been updated yet with the data submitted in the form).

Any kind of function to over-write data entered by the suer will have to go just before the fire issue post function and it will also have to manually perform a re-index. Just be careful, if you use high level helper functions, to do the update, you could end up also firing an update event as well as your issue resolved event.

The other option is that you create a loopback transition (Resolved -> resolved) that has condition that will only let it happen if the remaining estimate != 0, then you make it an automatic transition by exporting it xml and adding the auto attribute

In this transition, you would put the custom post function which would just wipe remaining estimate. So when a user triggers resolved transaction and estimate !=0, it auto fires

Mind you sounds like a lot of fuss to do soemthing not very conventional either. Why not leave the data in place and use it to improve estimate

?

0 votes
C_ Faysal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2013

hey.

can you post a screen shot of your postfunctions?

maybe re-ordering the functions could help.

i.e. place the function below the field update

Sergey Shmarkatyuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2013

screenshot has been added

C_ Faysal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2013

on your resolution screen (default) there should appear "Remaining Estimate"....isn't this set to "Adjust automatically" ?

i just tried...

created an issue and set due to tomorrow...

if i click resolve and leave "remaining estimate" on "adjust auto..." the worklog shows "Remaining: 0m"

i wonder what you're tryin to achieve

maybe the postfuction that purges Remaining Estimate is the wrong step

Sergey Shmarkatyuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2013

I do not know how you have managed to do this :), but when I resolve issues and set 'time spent' on the resolution screen using default JIRA configuration, remaining estimate is not set to 0h automatically by default (without any post-functions).

C_ Faysal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2013

so i also wonder how this is not working for you :)

i simply hit resolve...added 5m to time spent and left the selection for "Remaining Estimate" to "Adjust automatically"...no more tricks...

also no custom postfunctions are configured (only the defaults)

Sergey Shmarkatyuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

did you have original estimate?

Sergey Shmarkatyuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013
C.Faysal

, did you have original estimate?

C_ Faysal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

no i didn't set estimate during create..

Sergey Shmarkatyuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

the whole point is that original estimate should be set so that remaining estimate will be calculated as the difference originalEstimate - timeSpent

C_ Faysal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

yes you're right...

remaining estimate will be the value ("original Estimate" reduced by "time spent")

i just added original estimate and the remaining estimate is set that way

that is not the solution you want?

do you want remaing estimate to be set to 0h when the issue gets resolved?

Sergey Shmarkatyuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

yes, that's right. I want remaing estimate to be set to 0h when the issue gets resolved

Suggest an answer

Log in or Sign up to answer