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

Using scriptrunner and a post function to update subtasks


We have a bunch of post functions on a workflow that creates sub-tasks. It's working perfectly but what we are looking to do is create a Modify workflow. So if someone wants to modify the parent ticket it will automatically reopen any subtasks that are completed, push all of the custom field values to the subtasks and modify the summary of each of the subtasks with a MODIFIED prefix.

Can someone point me in the right direction on how to accomplish this easily?

Thank you so much in advance!


1 answer

0 votes

Hi Dan,

If you want the actions to be triggered on any update of the parent, rather than transitions only, then you will want to use a custom script listener on the Issue Updated event.

To update each of the child issues you should probably be able just to use a single IssueService action per issue, namely the transition action. You can update the custom field values and summary at the same time by passing their new values to the IssueService via the IssueInputParameters: the service will perform the transition and update in one go, the same as if you had edited the field values on the transition screen before submitting.

Let me know if you need me to expand on any of the above, I'm happy to write some example code although it may take me a little longer.


Thank you very much Jake!


Some example code would be amazing and definitely help us tremendously!


Really appreciate it!!!

Hi Jake! Just following up to see if you had any time to give some examples.

Thanks in advance!

Hi Dan,

Apologies for the delay in getting back to you. Here is an example of how to transition an issue while updating its summary and a custom field value. Note that the custom field value needs to be provided as a string irrespective of its type: the correct formats for doing this are detailed in the Atlassian documentation.

import com.atlassian.jira.component.ComponentAccessor

def is = ComponentAccessor.issueService
def u = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issue = ComponentAccessor.issueManager.getIssueObject("ISSUE-6")
def iip = is.newIssueInputParameters()
iip.summary = "MODIFIED " + issue.summary
iip.addCustomFieldValue(10033, "30/Dec/05 5:35 PM")
iip.skipScreenCheck = true
def vr = is.validateTransition(
is.transition(u, vr)


Suggest an answer

Log in or Sign up to answer

Atlassian Community Events