I have created a numeric scripted field to obtain the difference in minutes from the update field and today date.
the code that I used is the following:
updatedate = new DateTime(issue.updated).toDate()
todaydate = new DateTime().toDate();
def milsec = todaydate.getTime() - updatedate.getTime() as double
milsec = milsec / 60000
the searcher is numeric. and the template is custom.
in the preview mode I'm getting the correct value, but qhen I check it in the issue navigator I'm viewing random and incorrect values when I refresh the browser.
ANyone have an experiencie doing this type of customization?
thanks in advance.
If you tried to reindex in your script, you'd throw the system into a recursive loop - it would try to reindex itself during a reindex during a reindex during a reindex...
I'm afraid your field idea is not going to work. As Stephen says, the value of a scripted field is calculated and stored. Your field is effectively a live clock - to get the right answer from it, you're going to need to calculate the value every second, for every issue. That's simply never going to work.
What are you trying to achieve by calculating this?
Hi the idea is sent notifications after two days of inactivity in the issues. So I want to to count the inactivity days ignoring the weekends.
in the code example I trying to do it counting minutes to test the notifications.
then using escalation service I move the issue to an autotransition when a JQL query is true. Using a postfunction to send the notifications
When you say the values are random / incorrect, do you mean that they are behind what you would expect to see?
Script field values are calculated and stored in the index at the time that the issue is indexed, e.g. when it is modified or transitioned, or when you do a full re-index. This would explain why you are seeing different values in issue navigator because those results come from a search (I presume you mean in the issue search and not in the board).
You can work around this issue with a listener (documented here)
I hope this helps!
Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...
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!
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