You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
are you able to help me?
I have written a script for a listener. It is supposed to update a custom-field of an epic with the values from the linked stories.
The log shows me that the value has been calculated and updated:
... WARN [runner.ScriptBindingsManager]: setCustomFieldValue called with updateField: ABC, total: 468
... WARN [runner.ScriptBindingsManager]: Updating custom field with id customfield_123 for issue 456
But when I call Epic with the field and update it, the value is not displayed. What is going wrong?
Sure. Here it is:
Hey @Alexander B_ ,
after setting custom field value you need to perform an updateIssue using the following api https://docs.atlassian.com/software/jira/docs/api/8.0.1/index.html?com/atlassian/jira/issue/IssueManager.html
Issue updateIssue(ApplicationUser user, MutableIssue issue, EventDispatchOption eventDispatchOption, boolean sendMail)
The issue will be saved and re-indexed unless
EventDispatchOption.DO_NOT_DISPATCH is specified. This method performs no permission checks.
This method should be used if you want to exert more control over what happens when JIRA updates an issue. This method will allow you to specify if an event is dispatched and if so which event is dispatched, see
EventDispatchOption. This method also allows you to specify if email notifications should be send to notify users of the update.
user- who is performing the operation
issue- the issue to update
eventDispatchOption- specifies if an event should be sent and if so which should be sent.
sendMail- if true mail notifications will be sent, otherwise mail notifications will be suppressed.
Thank you, it works now. I've added this to the script:
I've added this but it won't work:
2022-12-13 12:36:40,926 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.IssueEvent, file: null java.lang.NullPointerException: Cannot invoke method setCustomFieldValue() on null object at com.atlassian.jira.issue.MutableIssue$setCustomFieldValue.call(Unknown Source) at Script194.run(Script194.groovy:70)