Can you change issue's project with IssueService.
i.e.
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters(); issueInputParameters.setProjectId(anotherProjectID); IssueService.UpdateValidationResult updateValidationResult = issueService.validateUpdate(authenticationContext.getLoggedInUser(), issueId, issueInputParameters); //updateValidationResult.isValid() returns true IssueService.IssueResult update = issueService.update(authenticationContext.getLoggedInUser(), updateValidationResult); //update.isValid() returns true
But the issue still belongs to the original project.
If I add other input parameters, i.e. description, they do get changed so the update works, but just not for the project.
Community moderators have prevented the ability to post new answers.
As far as I can see, this can not be done with IssueService.
This can be done easily with IssueManager instead.
MutableIssue issueObject = issueManager.getIssueObject( issueId ); Project projectObject = projectManager.getProjectObj(projectId); issueObject.setProjectObject(projectObject); issueObject.setKey(projectObject.getKey() + "-" + projectManager.getNextId(projectObject)); issueObject.store();
Edit:
* This is depricated and will stop functioning sometime, I still havn't found the proper way to move issue. I'll update this answer when I do.
* issueManager.updateIssue changed to issueObject.store();
is your tring to move the issue to some other project or just changing project?
if you are moving issue then you can't do this through api
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there a difference betwean move to another project and change a project?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes, if you change the project to issue it will change just project name but does't change issuekey of new project,
if you move the issue it will change both.
check the following post
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Rambanam Prasad,
This actually works. Changes the project and sets a new project key.
MutableIssue issueObject = issueManager.getIssueObject(issueId); Project projectObject = projectManager.getProjectObj(projectId); issueObject.setProjectObject(projectObject); issueObject.setKey(projectObject.getKey() + "-" + projectManager.getNextId(projectObject)); issueObject.store();
BUT....
MutableIssue's issueObject.store() is marked obsolete, so it's not very vise to use it in a new plugin.
I'm going to try to find another way....
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.
Yes,
I inject IssueManager issueManager and ProjectManager projectManager in the cosntructor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I really don't think you can just "change the project". You need to use "move" to move the issue from one project to another. The validate call you've found will probably enable you to check if some of the move process is ok, but I suspect there's a lot more to do than that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well There is no move() in the jira api for moving the issue.
only we have a UI control which does that..
do we have some programatical solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can set the following parameter to skip these checks:
issueInputParam.setRetainExistingValuesWhenParameterNotProvided(true,true); issueInputParam.setApplyDefaultValuesWhenParameterNotProvided(false); issueInputParam.setSkipScreenCheck(true);
But beside that, I don't think it's possible to move the Issue through simply changing the project.
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As far as I can see, this can not be done with IssueService.
This can be done easily with IssueManager instead.
MutableIssue issueObject = issueManager.getIssueObject( issueId ); Project projectObject = projectManager.getProjectObj(projectId); issueObject.setProjectObject(projectObject); issueObject.setKey(projectObject.getKey() + "-" + projectManager.getNextId(projectObject)); issueManager.updateIssue(authenticationContext.getLoggedInUser(), issueObject, EventDispatchOption.ISSUE_UPDATED, false);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
from: com.atlassian.jira.bc.issueInterface IssueService
This method will validate that the provided parameters are valid for the fields that are specified by the configured edit screen for the issues project/issue type. Any fields that are not included on the edit screen will not be validated or populated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.