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?
Thanks!
Hello,
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.
Regards,
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to help, sometimes a second set of eyes is all you need :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.