How to force update of issue ?

Albert Cameron July 19, 2021

One transition consists of 2 plugin postfunctions.

Both postfunctions write to the same field.

I noticed now that what the first postfunction wrote to the field is not available to the second postfunction. It seems that jira only updates the fields when the whole transition is finished. 

In the first postfunction I do  "set this field":

field -> field.createValue(issue, newValue);

And in the second postfunction I do "get this field":

 issue.getCustomFieldValue(field);

 But in the second postfunction I do not see the field value which was set in the first postfunction.

 

What can I do that the field value which is set in the frist postfunction is right away saved in the database.

 

Thanks.

1 answer

1 accepted

0 votes
Answer accepted
Hyrum Steffensen _Appfire_
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.
July 19, 2021

Hello Albert,

Updates to a custom field cannot be seen until the issue has been reindexed. Typically issues are reindexed at the end of the Post Function stack, so seeing the old value is often not noticed. However, if you are using a script, you may not see those changes. 

Take a look at the plugin documentation to see if there is a reindex routine or method. For example:

field -> field.createValue(issue, newValue);
// reindex issue here

Please let us know how it goes!

Regards,

Hyrum

Albert Cameron July 20, 2021

So we found a workaround.

Additional to the existing 2 postfunctions , we introduced a third postfunction which only job is to write to our notification field. So instead of 2 postfunctions writing to this field , we now have only 1 . And now it works. 

Suggest an answer

Log in or Sign up to answer