Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,823
Community Members
 
Community Events
168
Community Groups

How to make an update record in history tab of an issue after updating (Parent field)

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?

image.png

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events