Hi, I've upgraded my Jira as well as its plugins and I have problems with the following Behaviours plugin script:
FormField formOption = getFieldByName("select example") FormField formUserField = getFieldByName("Preview") FormField formMailOption = getFieldByName("Email template") tamplate = formMailOption.getFormValue() tamplate = tamplate.replaceAll(' ','_') def input = new File('mail/template/'+tamplate) formUserField.setFormValue(input.text) if (formMailOption.getFormValue() == 'Send solution') { formOption.setHidden(false) formUserField.setFormValue(input.text.replaceAll('\\$\\$SOLUTIONS','')) } else { formOption.setHidden(true) }
The behaviour work sometimes and on other times does nothing. I've opend the same issue in two browser windows and changed this behaviour field, on one window it workd and in the other it didn't. after refreshing the page sometimes it worked, and again, some time it didn't... there are no error messages in either of Jira's logs.
What am I doing wrong? how can I debug this? Thanks.
Since I had no way to debug this, I gave up on the behaviour plugin and wrote it using jquery:
AJS.$("#customfield_10402").bind("change", function () { var selected = AJS.$(this).val(); // show solution panel if needed var solutionPanel = AJS.$("#customfield_10404").parent(); if (selected == 'Send solution') { solutionPanel.slideDown(); } else { if (solutionPanel.is(":visible")) { solutionPanel.slideUp(); } } // load template var file_name = selected.split(' ').join('_'); AJS.$.ajax({ url: "/mail/template/"+file_name, type: "GET", data: ({projectsOnly : "true"}), dataType: "html", success: function(template){ AJS.$("#customfield_10403").text(template); if (selected == 'Send solution') { sendSolutionTemplate = template; } } }); });
Sorry, been on holiday.
formMailOption.getFormValue()
won't work post-jira 4.3, it will give you the ID of the Option object. It should be Field.getValue().
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.