Jira v6.0.2 doesn't run the java script from a custom filed description during create ticket process

In my project, we have 2 custom fileds (A&B) where "B" should always match to the group name from A followed by some additional name tag (Ex: A=ROY_RO. "B" Should be ROY_Approver). So, i've the below java script written to compare the group name "ROY" between "A & B" and do an additional check on "_App" from custom field "B" and let user submit the ticket only if it mathces...

I've placed this script in the descriptiong filed of custom filed "B". But, while creating ticket, this script was never called and ticket gets create when "B" has a different Gourpname.

Has anyone tried this earlier?

<script type="text/javascript">

AJS.$(document).bind('dialogContentReady', function(event, dialog) {

var submit_btn = document.getElementById("create-issue-submit");

//adding event listner for the submit button

submit_btn.addEventListener("click", function(e){

//get the groupName

groupName = document.getElementById("customfield_13401").value.split("_")[0];

// create the compare string

group_Ind = groupName + "_App";

console.log('the group ind is :' + group_Ind)

// get the approver

approverEl = document.getElementById("customfield_13410");

approver = approverEl.value

// compare the group_Ind with the approver to check for the match

console.log(approver.substring(0,group_Ind.length));

if (approver.substring(0,group_Ind.length) != group_Ind){

e.preventDefault();

document.getElementById("customfield_13410").value = "Incorrect Value"

}

}

});

</script>

1 answer

This widget could not be displayed.

Atlassian Group,

Can anyone help me with the information why Javascript is not been pickedup during ticket creation, Please?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

205 views 1 3
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