Behaviours Plugin- Groovy script does nothing sometimes without an error message

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)
if (formMailOption.getFormValue() == 'Send solution') {
} else {

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.

2 answers

1 accepted

1 vote
Answer accepted

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') {
		} else {
			if (":visible")) {
 		// load template
		var file_name = selected.split(' ').join('_');
			url: "/mail/template/"+file_name,
			type: "GET",
			data: ({projectsOnly : "true"}),
			dataType: "html",
			success: function(template){
				if (selected == 'Send solution') {
					sendSolutionTemplate = template;

Sorry, been on holiday.


won't work post-jira 4.3, it will give you the ID of the Option object. It should be Field.getValue().

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


279 views 0 7
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