Hi Folks!
I have managed with updating the Parent field of a sub-task, but I can't update the history log ( >> Can-I-change-the-parent-field-of-sub-task-in-Jira-via-REST-API )
I was searching here and found some solution but it doesn't work for me
issueManager.updateIssue(user,childIssue,EventDispatchOption.ISSUE_UPDATED, true)
The full code of the script is
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonBuilder
import groovy.transform.BaseScript
import javax.servlet.http.HttpServletRequest
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.pico.ComponentManager
import com.atlassian.jira.event.type.EventDispatchOption
@BaseScript CustomEndpointDelegate delegate
def issueManager = ComponentAccessor.issueManager
changeParent(
httpMethod: "POST", groups: ["jira-administrators","jira-robots"]
) { MultivaluedMap queryParams, String body, HttpServletRequest request ->
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
Issue childIssue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("TEST-361")
Issue parentIssue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("TEST-531")
ComponentAccessor.getSubTaskManager().changeParent(childIssue, parentIssue, user)
issueManager.updateIssue(user,childIssue,EventDispatchOption.ISSUE_UPDATED, true)
return Response.ok(new JsonBuilder([abc: 42]).toString()).build()
}
Could someone please say what is the proper way to have this record in the history tab?
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.