[ScriptRunner] how to clear form values in post function?


I am trying to write post function that reset user's values (values passed by user to transition screen form). I also need to move those values to the subtask issue so i used 'Create a sub-task' script post function variant and pass this code to it:

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue

def i =  transientVars.issue as MutableIssue
def originali = transientVars.originalissueobject as Issue

println originali.summary
println i.summary 

i.summary = originali.summary

It works, but the problem is with issue history:

Issue summary before transition was '10'. During transition i passed '11' to summary field on sreeen. After transition execution i got this history entry:



The values are swapped. How to fix it ?

1 answer

I found the solution.... just add:


and voilà laugh

JIRA logged only status change in history...


Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

175 views 0 5
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you