I am attempting to build an Automation for Jira rule that identifies the presence of a specific string in an Issue's Summary upon creation, assigns Issues that match to a particular individual, and then updates the Issue's Summary field to replace the string with another.
The first two are no problem, but, as I do not see a way to achieve the final step with Automation for Jira's "Edit issue" action, I'm attempting to update the Issue's Summary field with an "Execute a ScriptRunner script" action instead. While the script appears to run fine, the Issue's Summary field is never actually updated as a result.
My code is:
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.component.ComponentAccessor;
IssueManager im = ComponentAccessor.getIssueManager();
MutableIssue currentIssue = im.getIssueObject(issue.key) as MutableIssue;
def originalSummary = currentIssue.getSummary();
def trimmedSummary = originalSummary.minus("[originaldummyvalue]");
def newSummary = '[new-dummy-value]' + trimmedSummary;
currentIssue.setSummary(newSummary);
I've used the addMessage() function to log the script's progress and verify that newSummary contains the expected string value at the time it's fed to currentIssue.setSummary(), but the Issue's Summary field remains unchanged.
Is there a specific step that needs to be taken to force the updated value to be persisted in the database?