Why is "Resolution Date" not updating when I set "Resolution" programatically?

Brad Leary May 18, 2021

I have a plugin that is setting "resolution" by adding it to the issueInputParameters, validating, and saving.  This works as expected and the change is reflected on the issue.  However, "resolutiondate" is still null.  Most of the things I've read say that the "resolutiondate" is automatically derived from the last time the "resolution" was set (which would be fine if it worked).  I have also tried firing an IssueEvent with EventType ISSUE_RESOLVED_ID after the save, but that hasn't helped.

 

//Code to set the resolution
ResolutionManager resolutionMananger = ComponentAccessor.getComponent(ResolutionManager.class);
Resolution resolution = resolutionMananger.getResolutionByName(value);
issueInputParameters.setResolutionId(resolution.getId());

//Code to validate and save
IssueService.UpdateValidationResult updateValidationResult =
issueService.validateUpdate(user, issue.getId(), issueInputParameters);
IssueResult updateResult = issueService.update(user, updateValidationResult);

//Code to fire an issue resolved event
EventPublisher eventPublisher = ComponentAccessor.getComponent(EventPublisher.class);
HashMap<String,Object> paramMap = new HashMap<String,Object>();
eventPublisher.publish(new IssueEvent(issue, paramMap, user, EventType.ISSUE_RESOLVED_ID));

IssueInputParameters does have a setResolutionDate function, but it doesn't work (which I didn't expect it to based one what I've read).  Is there a way to force an issue to re-calculate the "resolutiondate"?

0 answers

Suggest an answer

Log in or Sign up to answer