Close Issue update does not work

without problems:

MutableIssue mutableParentIssue = issueManager.getIssueObject(id);
mutableParentIssue.setEstimate(120);
issueManager.updateIssue(mutableParentIssue.getAssignee(), mutableParentIssue, EventDispatchOption.ISSUE_UPDATED, false)

doesn't work:

MutableIssue mutableParentIssue = issueManager.getIssueObject(id);
mutableParentIssue.setStatusId("6"); // closed
issueManager.updateIssue(mutableParentIssue.getAssignee(), mutableParentIssue, EventDispatchOption.ISSUE_UPDATED, false)

why?

the self problem with mutableParentIssue.setStatusObject(..

1 answer

This widget could not be displayed.

You cannot simply set the status. Use IssueService to transition the issue until it reaches the CLOSE status (you may need to perform multiple transitions if you do not have direct transitions defined).

Something like that:

IssueService issueService = ComponentManager.getInstance().getIssueService();
TransitionValidationResult resultValidation = issueService.validateTransition(user, issueId, actionId, inputParameters);
if (resultValidation.isValid()) {
         result = issueService.transition(user, resultValidation);
         errors = result.getErrorCollection();
}

Note: I wrote it just by looking at docs; I think somebody posted a more complete code here ...

yes please more complete anyone. I dont understand to configure the issueInputParameters by IssueInputParametersImpl. Why i must self define the action parameter map.... . resultValidation.isValid() is alway false :(

i know this api.. but i run in dead ends.

MutableIssue mutableParentIssue = issueManager.getIssueObject(parentID);

IssueService issueService = ComponentAccessor.getIssueService();

IssueInputParameters issueInputParameter = issueService.newIssueInputParameters();

issueInputParameter.setSummary(mutableParentIssue.getSummary())

issueInputParameter.setDescription(mutableParentIssue.getDescription())

issueInputParameter.setAssigneeId(mutableParentIssue.getAssigneeId())

issueInputParameter.setReporterId(mutableParentIssue.getReporterId())

issueInputParameter.setProjectId(mutableParentIssue.getProjectObject().getId())

issueInputParameter.setIssueTypeId(mutableParentIssue.getIssueTypeObject().getId())

TransitionValidationResult resultValidation = issueService.validateTransition(mutableParentIssue.getAssignee(), mutableParentIssue.getId(), actionId, issueInputParameter);

only false, I tried all actionId

thanks a lot that was a very helpful pokes :P

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

477 views 3 17
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you