reindex issue after SIL script custom field return value changes

Hello!

I have SIL script custom field updated but not visible in search.

Are there some methods to automaticaly reindex issue when return value changes?

Manualy reindex JIRA is not a solution.

1 answer

1 accepted

1 vote
Accepted answer

Hi Sergey,

The SIL Script CF has multiple searchers available, depending on what type of value it holds. You can go to Administration->Custom Fields and on the "Edit" screen you should be able to choose which type of searcher you want. Note that changing the searcher, the name of the CF or the SIL script behind it requires a reindex. You should normally not need to manually reindex when the value changes, since it is automatically reindexed.

I don't understand if the problem is that the field is not searchable or if the values shown in search are incorrect.

I have this code to change 2 custom fields and return task overdue in SIL fileld.

string format = "yyyy.MM.dd HH:mm:ss";
string[] my_statuses;
string[] my_statusHistory = fieldHistory(key, "status");
date my_startDate;
date my_endDate;
date my_finalDate;
for(number i = 1; i < size(my_statusHistory); i = i + 2) {
 string my_statusStr = getElement(my_statusHistory, i);
if (my_statusStr == "3" && isNull(my_startDate)) {
  my_startDate = arrayGetElement(my_statusHistory, i - 1);
  }
if (my_statusStr == "5") {
  my_endDate = arrayGetElement(my_statusHistory, i - 1);
}
}

if (isNull(my_startDate) && (customfield_10611 != created)) {
  customfield_10611 = created;
} else if (isNotNull(my_startDate) && (customfield_10611 != my_startDate)) {
  customfield_10611 = my_startDate;
}

if (isNull(my_endDate) && (customfield_10612 != customfield_10107)) {
  customfield_10612 = customfield_10107;
} else if (isNotNull(my_endDate) && (customfield_10612 != my_endDate)) {
  customfield_10612 = my_endDate;
}

return ((customfield_10611 > customfield_10107) || (customfield_10612 > customfield_10107) || ((currentDate() > customfield_10107) && (customfield_10612 >= customfield_10107)));

SIL field have exact text seacher. But the values shown in search are incorrect. Manual reindex helps.

What versions of JIRA, keplercf and katl-commons are you using? I'm running into some other problems while trying to reproduce this.

JIRA 5.2.1

Kepler Custom Fields 2.1.4

katl-commons 2.0.10

https://jira.atlassian.com/browse/JRA-7809

This explains why searching is not working. It's old, but it still applies.

So the problem goes like this: The script should be read-only. You should not be able to modify the fields from the script and there's a good reason for that. If you modify any field, it will trigger a reindex on the issue. The reindex will try to get all the values of the custom fields (including the SIL script) and will re-run the script, which will trigger another reindex and so on and it should start spinning. We have implemented a mechanism to prevent this from getting into an infinite loop. It surprises me that you say this works (as you said on the other thread) since it does start spinning when I try to reproduce this and it will show an empty value for the SIL script cf.

Unfortunately, I don't see a way to make the search work. The issue will be automatically reindexed when someone updates it or if there's a scheduled reindex. If you try to trigger the issue update from the script, you'll bump into the above problem.

I had the problem you are talking about but solved it by updating fields only when they different. And I'll try to solve this task by making another custom field and update its value. I think this will trigger reindex. Am I right?

You will encounter the problem whenever you modify any field. It works now because you didn't need to update any values yet. Even if we assume this works, it's still not enough since the script will be triggered when the issue is shown (or needed somewhere else). So you'll need to view the issue in order for the indexes to be updated.

Think I got answer to my questions. Thank you! Didnt know that scripts triggered only when issue is viewed.

You could give JJupin a try if you like. It has a bunch of other useful functionalities like conditions, validators, post-functions, services, listeners and more, all based on the SIL scripting language. We're also preparing some really useful new features to work with the issue UI, so stay tuned :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 31, 2018 in Marketplace Apps

Marketplace Spotlight: Zephyr

Hello Atlassian Community! Each month, we run a series of Spotlights to highlight Marketplace vendors and apps that our team thinks this Community would find valuable. In last month's Spotlig...

412 views 0 3
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you