Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Custom field updated by script listener gives wrong query results

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

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

How is the listener writing back to the issue?

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
TAGS
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,953 views 11 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you