Hello team,
I have a java script that prefills value for certain fields on the create screen. It shows a value for assignee on the create pop up window. But when I press the create button and the issue is created the assignee remains unassigned and I am really not sure why it happens to the assignee field alone while it works for other fields.
Here is the code I am using:
<script type="text/javascript">
(function($) {
AJS.toInit(function(){
function buildTheTeam(){
AJS.$("#customfield_15533").closest('div.field-group').hide();
$(document.getElementById("customfield_14041")).change(function(){
switch ($(document.getElementById("customfield_14041")).val()) {
case "23125":
//assignee
AJS.$("#assignee-field").val("romeo.andaya");
//consulted
AJS.$("#customfield_17538").val("mark.dymek");
break;
default:
AJS.$("#assignee-field").val("romeo.andaya");
//consulted
AJS.$("#customfield_17538").val("mark.dymek");
}
});
}
function buildTheTeam1(){
var issuetype=AJS.$("#issuetype-field").val();
AJS.$("#customfield_15533").closest('div.field-group').hide();
$(document.getElementById("customfield_14041")).change(function(){
switch ($(document.getElementById("customfield_14041")).val()) {
case "23125":
//assignee
AJS.$("#assignee-field").val("romeo.andaya");
//consulted
AJS.$("#customfield_17538").val("mark.dymek");
break;
default:
AJS.$("#assignee-field").val("romeo.andaya");
//consulted
AJS.$("#customfield_17538").val("mark.dymek");
}
});
}
buildTheTeam();
});
AJS.$(document).ready(function(){
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context, reason) {
var issuetype1=AJS.$("#issuetype-field").val()
if(issuetype1=="Manufacturing Risk"){
AJS.$("#customfield_15533").closest('div.field-group').hide();
$(document.getElementById("customfield_14041")).change(function(){
switch ($(document.getElementById("customfield_14041")).val()) {
case "23125":
//assignee
AJS.$("#assignee-field").val("romeo.andaya");
//consulted
AJS.$("#customfield_17538").val("mark.dymek");
break;
default:
AJS.$("#assignee-field").val("romeo.andaya");
//consulted
AJS.$("#customfield_17538").val("mark.dymek");
}
});
}
else if(issuetype1=="Part Risk"){
AJS.$("#customfield_15533").closest('div.field-group').hide();
$(document.getElementById("customfield_14041")).change(function(){
switch ($(document.getElementById("customfield_14041")).val()) {
case "23125":
//assignee
AJS.$("#assignee-field").val("ray.pang");
//consulted
AJS.$("#customfield_17538").val("ray.pang");
break;
default:
AJS.$("#assignee-field").val("ray.pang");
//consulted
AJS.$("#customfield_17538").val("ray.pang");
}
});
}
AJS.$(document).bind('dialogContentReady', function(event, dialog) {
var issuetype1=AJS.$("#issuetype-field").val()
if(issuetype1=="Manufacturing Risk"){
AJS.$("#customfield_15533").closest('div.field-group').hide();
$(document.getElementById("customfield_14041")).change(function(){
switch ($(document.getElementById("customfield_14041")).val()) {
case "23125":
//assignee
AJS.$("#assignee-field").val("romeo.andaya");
//consulted
AJS.$("#customfield_17538").val("mark.dymek");
break;
default:
AJS.$("#assignee-field").val("romeo.andaya");
//consulted
AJS.$("#customfield_17538").val("mark.dymek");
}
});
}
else if(issuetype1=="Part Risk"){
AJS.$("#customfield_15533").closest('div.field-group').hide();
$(document.getElementById("customfield_14041")).change(function(){
switch ($(document.getElementById("customfield_14041")).val()) {
case "23125":
//assignee
AJS.$("#assignee-field").val("ray.pang");
//consulted
AJS.$("#customfield_17538").val("ray.pang");
break;
default:
AJS.$("#assignee-field").val("ray.pang");
//consulted
AJS.$("#customfield_17538").val("ray.pang");
}
});
}
});
});
});
})(AJS.$);
</script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.