Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Single-select returning null value in groovy script

I have the following in a groovy script:

def acceptField = customFieldManager.getCustomFieldObjectByName("Accept CR")
log.error("AcceptField: " + acceptField)
def acceptValue = mutableIssue.getCustomFieldValue(acceptField)
log.error("AcceptValue: " + acceptValue)
def groupField = customFieldManager.getCustomFieldObjectByName("Review Group")
log.error("GroupField: " + groupField)
def groupId = mutableIssue.getCustomFieldValue(groupField)
log.error("Group ID: " + groupId)


Accept CR and Review Group are both single-select fields.  Accept CR has only "Accept" and "Decline" as options, "Review Group" has a list of group ids.


When the script runs, I get this in the output:

2018-10-22 18:39:06,426 ERROR [workflow.ScriptWorkflowFunction]: AcceptField: Accept CR
2018-10-22 18:39:06,427 ERROR [workflow.ScriptWorkflowFunction]: AcceptValue: null
2018-10-22 18:39:06,427 ERROR [workflow.ScriptWorkflowFunction]: GroupField: Review Group
2018-10-22 18:39:06,427 ERROR [workflow.ScriptWorkflowFunction]: Group ID: Additional Reviewer


There's nothing I can see that is different between these fields.  They're on the same screen, same types of configurations, etc.  But no  matter what I do, Accept CR always returns null.


Any idea where to look to see what is wrong here?




2 answers

1 accepted

1 vote
Answer accepted
Elifcan Cakmak Community Leader Oct 22, 2018


Are you sure that Accept CR custom field is filled on that specific issue that you test? Because when I test your code, it works just fine and returns the values. If Accept CR customfield is empty on the issue, it returns null as expected. So your code seems to be correct.


Grrrr that was it, found that a script further up in the post-function chain was clearing out  those values for the next time someone hits that transition (it's a loop back transition).  I moved the clearing out piece into its own script and made that the last script called.  Thanks for the second pair of eyes lol

0 votes
Elifcan Cakmak Community Leader Oct 22, 2018

Glad to help, sometimes a second set of eyes is all you need :) 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,888 views 11 5
Join discussion

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