Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Behaviours server-side scripts not triggered when form loads

Piercarlo Macca-
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 10, 2019

Hello, I'm trying behaviours to create some custom fields changing their values / hidden property based on each other values and I'm stuck with some problems.

One of those problems is that my server side scripts are not triggered when the form first loads, for example I created a checkbox field with an options and I put 

def summ = getFieldById('summary')
summ.setFormValue("I'm ok!")

as a server-side script attached to the field;

documentation says about the server side scripts

Our server-side script, when written, will be called the first time this field appears, and any time the user changes it in the dialog.

But when the form first load (Create button)  that code does not triggers, while it does (correctly) when I check/uncheck the option on the chechbox.

Am I missing something or doing something wrong? How can I implement correctly that requirement?

1 answer

0 votes
Antoine Berry
Community Champion
May 13, 2019

Hi,

You should add this script to the Initialiser of the behaviour, so that it is triggered when the form is first loaded.

Antoine

Piercarlo Macca-
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 16, 2019

Yes sorry I had not been clear enough, I was referring  to the part in the behaviours documentation where it says about the server side scripts

Our server-side script, when written, will be called the first time this field appears, and any time the user changes it in the dialog.

I can' t well understand what that "the first time this field appears" thing means.

Antoine Berry
Community Champion
May 16, 2019

This means the script will be called if the field is on the form. It will be called again each time the value is updated (i.e. if you check/uncheck a box). 

I believe the behaviours should be triggered when the create issue form loads (it works that way on my jira). Have you set a condition ? Could you provide a screenshot of your behaviours configuration ?

Thanks !

Suggest an answer

Log in or Sign up to answer