Is it possible that Jira caches field values ?

Albert Cameron October 15, 2021

To get the value of a field I normal do:

Optional<CustomField> employeeCustomField =getCustomfieldByName(MAILCONTAKT_EMPLOYEE);
String employeeCustomFieldValue = (String) someIssue.getCustomFieldValue(employeeCustomField.get());

And normally it worked.

But now to test it , I cloned the issue with all its subissues. 

And I always update the respective field with a new value. Then I clone again and update again the field and so on.

First and second time in the log I saw it retrieved the new value.

But later even if I updated the field value in the issue , I curiously got the old value.

Even if I update again , I still get the old value. So all updating has no more effect.

That already cost me hours and hours. But I really do not know  why and how it can still get the old value.

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Nic Brough -Adaptavist-
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.
October 15, 2021

Where are you running this?  And what is the rest of the script doing?

Albert Cameron October 15, 2021

I run it in a postfunction outsourced to an own plugin

Nic Brough -Adaptavist-
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.
October 15, 2021

Ok, what does the rest of the postfunction do?

Albert Cameron October 15, 2021

it calls a REST Api and sending the data retrieved from the issue fields.

Nic Brough -Adaptavist-
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.
October 15, 2021

Ok, so can you walk through replicating this problem?  You've talked about cloning and updating issues, but I think we need to see the whole thing (that's why I asked about the rest of the post-function - I didn't know if you were cloning/updating in there).  If you could sketch out something like:

  • Clone ABC-123 to create ABC-456
  • Amend field on ABC-456
  • Transition issue, going through my post-function that
    • Gets some data from <remote system>
    • Works out what to do with it
    • Updates the employee field (as per posted code)
  • And then say where the problem occurs - like "the employee field on ABC-456 remains as what was on ABC-123", or "I clone ABC-456 and do exactly the same process creating ABC-789, but the employee field takes on the value from ABC-123"

That would be really helpful

Albert Cameron October 15, 2021

There is a issue of type order . And it has subissue connected to it of type person

So I trigger a postfunction in order and it will read field contactaddress from person and send it to backend. So because I cannot trigger the postfunction again , I need to clone the order issue with person issue will also be connteced to the clone. If I now change value of field contactaddress in person and again trigger the clone order issue I would expect that the updated value will be sent to backend . But this is not the case. Instead old value is read and sent to backend. Honestly I do not know where this old value is available. Really weird.

Nic Brough -Adaptavist-
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.
October 15, 2021

I am sorry, but I am struggling to understand what your process steps are there.  Could you go over it again, but use Jira actions to explain it, and differentiate between the different issues? 

It is unclear what your "need to clone" and "send to back end" mean, and what issue you are talking about.  I understand that you have an order issue type and a person issue type, but there are at least three separate issues involved in your walkthrough and I cannot tell which ones you are talking about when you just say "order" or "person"

We really do need to have this done in jira-speak - something like:

  • I create a new issue (type order), it gets called ABC-123
  • I create three sub-tasks beneath it (type person), they are ABC-124, ABC-125, ABC-126
  • I transition ABC-123 from "new" to "in progress", which makes my post-function run
  • I edit ABC-123, changing the field contactaddress

and so-on.

TAGS
AUG Leaders

Atlassian Community Events