Check out this snipper that updates a bunch of issues' customfields:
for (issue in parentsIssue) {
issue.update {
setCustomFieldValue('xx', issue.getCustomFieldValue('yt').toDouble().round(1).toString())
setCustomFieldValue('xc', issue.getCustomFieldValue('yy').toDouble().round(1).toString())
setCustomFieldValue('xv', issue.getCustomFieldValue('yu').toDouble().round(1).toString())
setCustomFieldValue('xb', issue.getCustomFieldValue('yi').toDouble().round(1).toString())
setCustomFieldValue('xs', remaining_ce.round(1)?.toString())
setCustomFieldValue('xd', remaining_ef.round(1)?.toString())
setCustomFieldValue('xa', remaining_eg.round(1)?.toString())
setCustomFieldValue('xy', remaining_xx.round(1)?.toString())
}
}
The "update" block should commit all the changes back to the database at once in a single transaction.
I would check that you don't have automations or other listeners that are then firing and delaying the execution of the subsequent loop.
What causes the script to run? Is it part of a Behavior, a Script Listener? Automation rule?
When I'm updating issues like this, I typically do it in a Script Listener where I'll set the values and then run the following to update and re-index the issue. I've never had a problem with these updates taking a noticeable amount of time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.