Can I populate a field based on selection of another during Create Issue?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Can I populate a field based on selection of another during Create Issue?

forums-5
During the Creating Issue process as I am filling in the various fields, is there a way to populate one field based off of the selection of another.  Here are 2 cases in question:
1) When I select a value from a Single Select List field, I would like to copy the text of that value into the Summary field.

2)  Based on the selection of the Single Select List, I would like to limit what can be selected from the Priority select list - or at least automatically change the value of the Priority.

Thanks
Brad.
--
Post by BradKyer - online at:
http://forums.atlassian.com/thread.jspa?forumID=46&threadID=54809
_______________________________________________
Jira-user mailing list
[hidden email]
To unsubscribe or change your options visit this page:
http://lists.atlassian.com/mailman/listinfo/jira-user
Reply | Threaded
Open this post in threaded view
|

Re: Can I populate a field based on selection of another during Create Issue?

forums-5
Javascript.

You can attach an onchange to the single select field and populate other fields with it. Just throw the script into a [Message Custom Field|https://studio.plugins.atlassian.com/wiki/display/JTOOL/JIRA+Toolkit+Plugin] and put it on the same screen. Make sure it comes AFTER your single select field.

Quick Example:
{code}document.getElementById("customfield_xxxxx").onchange = function() {
        //1) When I select a value from a Single Select List field, I would like to copy the text of that value into the Summary field.
        document.getElementById("summary").value = document.getElementById("customfield_xxxxx").options[document.getElementById("customfield_xxxxx").selectedIndex]; //double check this syntax, this is what I remember off the top of my head
        //Based on the selection of the Single Select List, I would like to limit what can be selected from the Priority select list - or at least automatically change the value of the Priority.
        switch(document.getElementById("customfield_xxxxx").options[document.getElementById("customfield_xxxxx").selectedIndex]) {
                case 1:
                        document.getElementById("priority").selectedIndex = 1;
                        break;
                case 2:
                        document.getElementById("priority") = 2;
                        break;
        }
};{code}
--
Post by edchan - online at:
http://forums.atlassian.com/thread.jspa?forumID=46&threadID=54809
_______________________________________________
Jira-user mailing list
[hidden email]
To unsubscribe or change your options visit this page:
http://lists.atlassian.com/mailman/listinfo/jira-user