Behaviours Initialiser Function not working

I cannot get the following Initialiser Function code to work.

if (getActionName() == "Create Issue") {
FormField desc = getFieldById("description")
log.error "END INITIALISE"

However if I move this code to the usual field mapping server side scripts pane it works just fine. The trouble is i want this code to only fire once on initial presentation of the "Create Issue" screen, so i need to be in the Initialiser section.

Any ideas why the Initialiser Function of the Behaviours plugin is not working for me?

In debug mode I am not even getting the error log messages so the entire Initialiser Function seems to be ignored.

JIRA 6.3.7

Scriptrunner 3.0.10


7 answers

is there any update on this problem? I'm also having same issue. 



I got the same problem ... logging runs through - all outputs are within the logs, but the description is not set sad

I mapped the behaviour to 4 projects with a specific issue type. The Configuration looks like this:

image2015-6-22 10:31:29.pngI am on JIRA 6.3.15 and Scriptrunner 3.0.16.

Should work... looks OK... can you paste a screenshot of the behaviour config? The page that shows the connection between fields and server side scripts. Have you mapped the behaviour to a project(s) / issuetype(s) combination?

Hi Jamie,

I am actually trying to do this for the Priority field. I need to remove from view for 1 project the MoSCoW priority values we also have. Here is my Behaviours config -


I can remove the priority options I don't need but i can't get the Initialiser to run to set the default to "Major" rather than the invalid "MUST" which is the system default.

On initial form load I get what is in the image below. "MUST" will disappear from the options once i then choose something.


I have since tried to get the Initialiser Function to work on other custom fields but nothing happens, so I dont believe this is specific to me trying to manipulate the system Priority field.





I have been experiencing similar issues as raised. Not able to get the initialiser to function or debug lines logging. Using JIRA 6.4.3, ScriptRunner 3.0.16. My initialiaser script is a simple intialise a user picker custom field as the "current user": import com.onresolve.jira.groovy.user.FormField import com.onresolve.jira.groovy.user.FieldBehaviours import com.atlassian.jira.ComponentManager log.debug("--------------------This is to test Behaviours Logging----------------") def rejectedWithdrawnByField = getFieldByName("Rejected / Withdrawn By") def currentUserName = ComponentManager.getInstance().getJiraAuthenticationContext().getUser().getName() rejectedWithdrawnByField.setFormValue(currentUserName) log.debug("Rejected Withdrawn By: " + rejectedWithdrawnByField.getValue())

Hi Conor,

I've tried your code and it works. This is the screenshot of the result:


Screen Shot 2015-05-28 at 10.36.35.png

Is your initialiser function in the right mapping? Wrong issue type?

Screen Shot 2015-05-28 at 10.43.22.png


You may try to create a new test behavior with: Mapping: * Issue types: Any issue type * Projects: your project initialiser function: log.error "START INITIALISE" This is the most basic/clean case we may use to start to investigate. Can you see that message on the log when you create an issue?

@Conor McCooey

I think this bug can be related to this one:

I am going to investigate further, I'll update that ticket when finished.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

446 views 8 26
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