Hi all,
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?
Cheers,
Alexander
Sure. Here it is:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 operationissue
- the issue to updateeventDispatchOption
- 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.You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, it works now. I've added this to the script:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But maybe you can still help me. I have deleted a few test tickets and would have expected the value to be reduced accordingly. What is here missing?
The value has remained the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok. It is because of the deletion. It creates a nullpointer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Issue Deleted is a different event from Issue Updated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've added this but it won't work:
(plus)
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.