Moving issue using JAVA API + redirection of old issue key to new one

I created a post-function that upon a transition moves an issue to another specific project
Snippet of the code as follow:
String targetIssueType = (String) args.get(TARGET_ISSUE_TYPE);
String targetProjectKey = (String) args.get(TARGET_PROJECT_KEY);
Project targetProject = projectManager.getProjectByCurrentKey(targetProjectKey);
final long nextProjectIssueNumber = projectManager.getNextId(targetProject);
MutableIssue mutableIssue = getIssue(transientVars);

My problem is that I need the old issue key to redirect to the new one, just like the native JIRA move!

Any help on what am I missing?

1 Like