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>
Atlassian Group,
Can anyone help me with the information why Javascript is not been pickedup during ticket creation, Please?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.