Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Update Summary field with the "Execute a ScriptRunner script" action in Automation for Jira.


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;


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?

4 answers

2 accepted

1 vote
Answer accepted
Erik Buchholz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 05, 2021

Hi @Matt Nolley ,

yes, setSummary sets the string only to the MutableIssue variable and does not save it to the database. To save the changes to the database use

IssueManager#updateIssue(ApplicationUser user, MutableIssue issue, EventDispatchOption option, boolean sendMail)


IssueManager.updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)

I'm not sure if you need to re-index the issue after that manually. In most cases I use post functions or similar workflow scripts that do both actions for the _issue_ variable.

You can try if the scriptrunner action in automation for jira does the same for the _issue_variable, but this is in many cases no MutableIssue but only an Issue.


1 vote
Answer accepted
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 05, 2021

Hi @Matt Nolley ,

yes, please try something like:

import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser

IssueManager im = ComponentAccessor.getIssueManager()
MutableIssue currentIssue = im.getIssueObject(issue.key) as MutableIssue
ApplicationUser loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def originalSummary = currentIssue.getSummary()
def trimmedSummary = originalSummary.minus("[originaldummyvalue]")
def newSummary = '[new-dummy-value]' + trimmedSummary;

im.updateIssue(loggedInUser, currentIssue, EventDispatchOption.DO_NOT_DISPATCH, false)

So...I almost immediately discovered I was wrong about not being able to solve my issue with Automation for Jira's "Edit issue" action.  The smart value "{{issue.summary.replace("[originaldummyvalue]", "[new-dummy-value]")}}" took care of my need.

However, I still remain curious as to why my script's changes didn't stick.

The above Accepted Answer from Hana Kučerová is correct, but if you want to actually update the issue, you need to change:




 or something other than DO_NO_DISPATCH

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events