Forums

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

Custom field updated by script listener gives wrong query results

Nadav Eckstein February 10, 2019

Hi,

I would very much appreciate your help with something since it's been bothering me for a while.

I have created a custom field (single select list) and created a script listener that updates this field every time the assignee field changes.

It works well, but for some reason, once in a while a query on this field will give incorrect results. For example, I can run this query: field="Option 1"

While "field" is the custom field name and "Option 1" is one of the possible options.

Most of the issues that will answer this query will be correct, but once in a while I might find there an issue with field="Option 2", although it shouldn't be there.

Does anybody have an idea why is this happening?

 

Thanks!

1 answer

1 accepted

0 votes
Answer accepted
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.
February 10, 2019

It sounds like the index is not being updated properly in every case.

How is the listener writing back to the issue?

Nadav Eckstein February 10, 2019

Hi Nic,

Thanks for the quick response.

This is how I update the field in the listener:

 

def value = ComponentAccessor.optionsManager.getOptions(cfConfig)?.find {
it.toString() == new_value
}
tgtField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(tgtField), value),changeHolder)

 

new_value is just a string.

Suggest an answer

Log in or Sign up to answer