I want to do this script but with groovy script using script runner. Is it possible? How would it look like?
<script type="text/javascript"> priority = document.getElementById('priority'); if (priority) { target = document.getElementById('customfield_10000'); // Hide the target field if priority isn't critical if (priority.value != 2) target.style.display='none'; priority.onchange=function() { if (this.value == 2) { target.style.display = ''; target.value="enter message here"; } else { target.style.display='none'; } } } </script>
Happy to help, if it works for you, please accept/upvote the answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Script fields is for showing calculated data based on issue data and not for show/hide of fields. From your code sample it seems you are trying to hide a custom field based on the value of priority. For achieving this you have to use the "Behaviour module" of the SR plugin instead of script fields.
https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For a none developer this is not good enough documentation. I wan't real example that I can use for this purpose.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There are plenty of examples available on this forum if you just search for them.
https://www.idalko.com/use-behaviour-functionality-script-runner-show-hide-fields/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.