scripted field script executes while not on screen

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

182 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you