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?
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
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 ...
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