Hi,
I have multiple declarations pulling in numeric values into a post-function. They all work excluding one; I am getting this error:
2023-03-23 15:13:04,837 ERROR [workflow.AbstractScriptWorkflowFunction]: Workflow script has failed on issue ABC-123 for user 'rbourg'.
View here: http://[site URL]/secure/admin/workflows/ViewWorkflowTransition.jspa?workflowMode=live&workflowName=[workflow name]=postfunctions&workflowTransition=1&highlight=26 java.lang.NullPointerException:
Cannot invoke method getValue() on null object at Script90.run(Script90.groovy:55)
Here's the variable declaration, that is written the exact same way as other variables that are working as expected.
Don't look for anything mysterious in the API, it works, so it is most definitely an issue somewhere in the name and/or field's visibility for the issue. Maybe it contains a space at the end, maybe it contains unprintable unicode. It should be possible to list the fields such as
for (def cf : cfManager.getCustomFieldObjects(issue))
log.warn("DEBUG - field='" + cf.getName() + "'"
and then confirming the name is in that list at all to begin with, if it is, whether it has any extra spaces. This won't show unprintable characters, but if you can prove that the name is identical to an eye, then you know there is a "hidden" difference in characters. I've seen plenty null bytes in all sort of places that beg the question of how do people even paste so many of them.
I'm not familiar with 'findByName' - I assume it works, and it reads to me that you're saying it works elsewhere, so not going to doubt it. If you haven't verified that method, you could try plain old groovy syntax such as
cfManager.getCustomFieldObjects(issue).find { it.getName() == "Datafeeds Hours" }
Although they should work the same in theory I assume.
If you see the same name, no extra spaces and whatnot, and it still doesn't work, it would be interesting to see the hex value of the name if it contains something splendid, e.g. by dumping it from the db to a hexeditor.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.