scripted field script executes while not on screen

Alexander Becker August 19, 2015

Hi,

I started developing scripts in JIRA server 6.2.4, using the groovy scriptrunner plugin.

I want to populate a custom field (multi-line text - id: customfield_11170) with data from other custom fields on the "create issue"-screen, so that the populated field shows up on the "view issue"-screen.

When adding this scripted field to a any screen (doesn't matter on which screen) it executes , why?

It should only execute on the one screen I configured.

So I got the problem using one scripted field on create issue secreen and one on a transition screen, because the both execute on any transition!!!

I possible did not understand the hierarchie od JIRA, so please help me understand.

 

Thank you,

Alexander

1 answer

0 votes
Błażej O_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2015

I think that all of the scripted custom fields execute whenever JIRA is checking the value of the field. And JIRA does that A LOT. Basicaly each time you view issue, either directly or indirectly (displayed as link or on the dashboard gadget or as a rest API response), JIRA has to look up all the issue fields in context. You can see every execution of the field by adding a logging command to your script.

 

However there are plugins that can do exactly what you are trying to achieve - fire up a script on the create issue screen. I think "Behaviours" (currently being integrated with Script Runner) plugin can do that, as well as awesome JJupin plugin with it's "Live Fields" module.

 

EDIT:

Oh, and being aware that the scripts execute each time when you view issue, be REALLY careful to make your scripts in custom fields lightweight! In our company JIRA we've gone through the hype of "OMZG, SCRIPTED FIELDS EVERYWHERE *_*" and we have almost killed our instance by overusing scripted fields and making them far too complex. Scripted fields are awesome, and very powerful when used right, but remember that "with great power comes great responsibility" wink

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events