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

Your Points Tracker
Challenges
Leaderboard
  • 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
Recognition
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?
Kudos
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

Using scriptrunner and a post function to update subtasks

Hello

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!

Dan

1 answer

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.

J

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(
u,
issue.id,
5,
iip
)
is.transition(u, vr)

J

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Why everyone using Jira must be GDPR-compliant

Did you know that penalties up to 4 % of the yearly company turnover are possible in case of GDPR violations? GDPR regulations are currently mainly relevant for companies in the EU, but countries lik...

81 views 1 2
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