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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

147 views 1 10
Read article

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