Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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?

3 answers

2 accepted

1 vote
Answer accepted
Hana Kučerová Community Leader 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)
1 vote
Answer accepted

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.


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.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

361 views 9 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you