Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,557,528
Community Members
 
Community Events
184
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
AUG Leaders

Atlassian Community Events