When using a custom velocity template to render a script field, the behavior when 'previewing' it appears to have significant/breaking differences from how the template behaves on actual issue screens. Particularly around the type of the $value... value.
For example, if my script field returns a map object, I can tell a custom template to render a value from that map. In other words, if I tell the template to render...
$value.get('some_key')The referenced value pops out successfully. Woo.
If I then go to look on at the field on the same tested issue key directly after saving this setup, the field cheerfully shows a literal "$value.get('some_key')".
Poking at it a bunch, it seems to be because, in "real" Jira, $value is always, alllllways just a string, so there's nothing to 'get' and velocity does its fallback behavior.
So I guess I have two questions?
- Is ScriptRunner's preview function bugged/incorrectly handling values and overpromising, just to break my heart later, and
- Is there any way to pass more than a single just-a-string to the template? Can additional parameters go between the script and the template in some way?