Search

Page tree
Skip to end of metadata
Go to start of metadata

Update issue summary wirh scriprunner script listener

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.bc.issue.IssueService.UpdateValidationResult
import com.atlassian.jira.bc.issue.IssueService.IssueResult
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.bc.issue.IssueService

import com.atlassian.jira.user.ApplicationUser
//import com.atlassian.crowd.embedded.api.ApplicationUser
import com.atlassian.jira.event.issue.IssueEvent
ApplicationUser user = event.getUser();

IssueService issueService = ComponentAccessor.getIssueService();
MutableIssue issue = event.issue as MutableIssue;

IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
issueInputParameters.setSummary("newSummary")

UpdateValidationResult updateValidationResult = issueService.validateUpdate(user, issue.getId(), issueInputParameters);

if (updateValidationResult.isValid())
{
    IssueResult updateResult = issueService.update(user, updateValidationResult);
    if (!updateResult.isValid())
    {
        // Do something
    }
}
  • No labels