Hello,
I am looking for a solution to change the default rows of multi select custom field (right now is 5 rows). Before Jira v8, I was able to use the script below per this document: https://confluence.atlassian.com/display/JIRA050/How+to+change+Multi+Select+Custom+field+size+using+script?_ga=2.127621583.311521503.1588613064-1990727685.1587148620
<script type=
"text/javascript"
>
mselectbox = document.getElementsByName(
'customfield_10200'
);
mselectbox[
0
].setAttribute(
"size"
,
"20"
);
</script>
Your help is really appreciated.
Sara Lam
Hi @Sara Lam
The scripts below will look for for a element with ID 'customfield_10200' and set the size attribute to 20. You might have to change the ID in order to fit the real ID.
Using native Javascripts
<script type="text/javascript">
// Native Javascript
var selectBox = document.getElementById('customfield_10200');
selectBox.setAttribute("size", "20");
</script>
Using JQuery
<script type="text/javascript">
// Using JQuery (built in Jira)
(function ($) {
AJS.$("#customfield_10200").attr("size","20");
})(AJS.$ || jQuery);
</script>
Hope this will work.
Regards
Lasse Langhorn
Hi Lasse,
Thank you so much for the suggestion. Where should I put this script in? If I put it in the field configuration custom field description area, It seems Jira v8.7 removed the ability to run script there. Should I put it in banner? If so, the script will apply to all projects (not project, issuetype specific anymore). Here is what I got in the field description when I create a ticket:
Thanks again,
Sara
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sara Lam
I would the place the HTML in the Jira banner and yes it will be executed for all Jira projects.
If this is not OK then I will take a look at Behaviours from Scriptrunner which is capable of controlling Jira issue field behaviour.
Regards
Lasse Langhorn
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.