Scriptrunner Behaviour shared validator script

I have multiple fields that need tha same validation script run. My case is complex but let's say I've got 10 numeric fields and when any of them change, an 11th fields will be updated with the sum of fields 1 to 10.

Do I do "code reuse" via copy and paste, or is there a better way?

 

1 answer

This widget could not be displayed.
Tarun Sapra Community Champion May 22, 2017

Why you tried using "Script Listerner" for this scenario? i.e. writing a custom listener. - https://scriptrunner.adaptavist.com/5.0.0/jira/listeners.html 

Or  do you need to use Behaviour?

I need both, but ended up using listener + javascript in field description.

I wanted a real-time update of the fields as the user was editting them but also needed to create a listener to cater for cases where one of the fields are edited via other means.

Javascript works a bit better than behaviours for this as it can all run locally, but I needed to split my code across 3 fields as it was too big. Not a great solution but it works.

 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

189 views 3 0
Join discussion

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