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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

86 views 0 5
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