I am trying to update and issue after changing assignee of the Issue with JIRA 6.3.13 version.
But its throwing below exception. Tried multiple things but getting same error.
Could you please let me know how to update the issue and reindex it?
No signature of method: com.atlassian.jira.issue.managers.DefaultIssueManager.updateIssue() is applicable for argument types: (com.atlassian.jira.user.DelegatingApplicationUser, com.atlassian.jira.issue.IssueImpl, com.atlassian.jira.event.type.EventDispatchOption$EventDispatchOptionImpl, java.lang.Boolean) values: [patdi004(patdi004), IN-35, com.atlassian.jira.event.type.EventDispatchOption$EventDispatchOptionImpl@5193c02e, ...]
Possible solutions: updateIssue(com.atlassian.crowd.embedded.api.User, com.atlassian.jira.issue.MutableIssue, com.atlassian.jira.event.type.EventDispatchOption, boolean), updateIssue(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.MutableIssue, com.atlassian.jira.issue.UpdateIssueRequest)
Here is my code snippet:
ApplicationUser appUser = ComponentAccessor.getUserUtil().getUserByName("XYZ")
User user = appUser.getDirectoryUser()
issue.setAssignee(user)
//ComponentAccessor.getComponent(IssueManager.class).updateIssue(ComponentAccessor.jiraAuthenticationContext?.user,issue, EventDispatchOption.DO_NOT_DISPATCH, false)
ComponentAccessor.getComponent(IssueManager.class).updateIssue((ApplicationUser)ComponentAccessor.jiraAuthenticationContext?.user,issue, UpdateIssueRequest.builder().build())
ComponentAccessor.getIssueIndexManager().reIndex(issue)
Community moderators have prevented the ability to post new answers.
Hi Dipenkumar!
I advise you to use IssueService.update method which does re-index:
Please use validateUpdate https://docs.atlassian.com/jira/latest/com/atlassian/jira/bc/issue/DefaultIssueService.html#validateUpdate(com.atlassian.jira.user.ApplicationUser,%20java.lang.Long,%20com.atlassian.jira.issue.IssueInputParameters) to get UpdateValidationResult.
Thanks Volodymyr for your reply. As you suggested I implemented my code but somehow Issue is not getting update evernthough my log message says updated successfully. I tried it 2 different ways but no success. def ApplicationUser user = ComponentAccessor.userUtil.getUserByName("JIRASupport") log.warn("Current Assignee: " + issue.getAssigneeUser().getName()) issueInputParameters.with { //setAssigneeId(user.getName()) issue.setAssignee(ApplicationUsers.toDirectoryUser(user)) } log.warn("New Assignee : " + issue.getAssigneeId() +" UserName: " + issue.getAssignee().getName()) def IssueService.UpdateValidationResult validationResult = issueService.validateUpdate(ApplicationUsers.toDirectoryUser(user),issue.id,issueInputParameters) if(validationResult.isValid()){ issueService.update(ApplicationUsers.toDirectoryUser(user),validationResult) ComponentAccessor.getIssueIndexManager().reIndex(issue) log.warn("${validationResult.issue.key} has been updated successfully") }else{ log.warn(validationResult.errorCollection) } Log Message: /secure/WorkflowUIDispatcher.jspa [com.custom.IntakeListener] Not assigned to JIRA Support /secure/WorkflowUIDispatcher.jspa [com.custom.IntakeListener] ******** Updating ********************************* /secure/WorkflowUIDispatcher.jspa [com.custom.IntakeListener] Current Assignee: patdi004 /secure/WorkflowUIDispatcher.jspa [com.custom.IntakeListener] Assignee Changed /secure/WorkflowUIDispatcher.jspa [com.custom.IntakeListener] New Assignee : jirasupport UserName: JIRASupport /secure/WorkflowUIDispatcher.jspa [com.custom.IntakeListener] IN-35 has been updated successfully AM I doing anything wrong here? Please help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dipenkumar! I have similar code that in Java that creates issues via issueService.create and it works fine. BTW you should not invoke ComponentAccessor.getIssueIndexManager().reIndex(issue) since issueService.udpate already does re-index. Only guess is that your index file is broken so please try to reindex through JIRA admin and then run the code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After re-indexing also I am seeing same behavior as earlier. Log says updated successfully but it doesn't reflect actually. ComponentAccessor.getIssueIndexManager().reIndex(issue) added as its not working but initially wrote it without this line. What else should I do?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As I said, issueService.create works fine for me. And I have no idea why issueService.update does not work for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry :-(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Resolved the issue by adding these line in my code. issueInputParam.setRetainExistingValuesWhenParameterNotProvided(true,true); issueInputParam.setApplyDefaultValuesWhenParameterNotProvided(false); issueInputParam.setSkipScreenCheck(true); Now its working fine. Thanks Volodymyr for your initial help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad that you resolve this and thank you for sharing! I am sure that with issueService.update I would hit the same problem :-)
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.