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

ScriptRunner Post Function is inconsistent Edited

Hi Folks,


This post function seems to be inconsistent for me with the value printed being either pre-screen or post-screen.


Any ideas on what could be happening and how i could fix?


def someFakeCustomFieldId = 'customfield_123456'

def issueWithScreenChanges = get("/rest/api/2/issue/${}")
.queryString("fields", someFakeCustomFieldId)

def newValue1 = issueWithScreenChanges.fields[someFakeCustomFieldId] as String

def newValue2 = issue.fields[someFakeCustomFieldId] as String

2 answers

1 accepted

0 votes
Answer accepted

Discovered that because saves from a transition are async, the values entered into the screen cannot be reliably retrieved during the post function.  I was able to work around this by converting to a listener.

Try this :

def issueBody = issueWithScreenChanges.body
return issueBody.fields[someFakeCustomFieldId] as String

Also, in post function you don't need to get the issue, you can do this:

def someFakeCustomFieldId = 'customfield_123456'

def newValue1 = issue.fields[someFakeCustomFieldId] as String

def newValue2 = issue.fields[someFakeCustomFieldId] as String

If you take the issueWithScreenChanges object you need to add "body", but if you run the script as post function you can just take the cf from the issue object like this- 



Thanks Neta.  You'll see that i'm already pulling body as part of issueWithScreenChanges (Line 6 of my example)


I went ahead an posted what I discovered and the solution below.

Suggest an answer

Log in or Sign up to answer
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

94 views 0 5
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