Forums

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

Set field value with behaviours for Jira Cloud

Serena Romeo September 14, 2023
Hello,

I have a text field that I need to fill with a numeric value if other field values are set by the user to certain options.
I was able to obtain this, through scriptrunner's behaviours, with the following code:

const richiesta = getFieldById("customfield_10264");
const complex = getFieldById("customfield_10266");
const valoAtt = getFieldById("customfield_10267");
if (richiesta.getValue().value == "Performance Test" && complex.getValue().value == "Bassa") {
valoAtt.setValue('30');
} else if (richiesta.getValue().value == "Performance Test" && complex.getValue().value == "Media") {
valoAtt.setValue('40');
} else if (richiesta.getValue().value == "Performance Test" && complex.getValue().value == "Alta") {
valoAtt.setValue('50');
}

This is working as expected, but I want to be able to manually edit the text field if I need to. Now if I try to edit it, it immediately gets back to the value I told the behaviour to set the field to.
Any help is really appreciated!
Thanks,
Serena

1 answer

1 accepted

0 votes
Answer accepted
Jeroen Poismans
Community Champion
September 14, 2023

Hi Serena,

Seems as if you have the On change option of your Behaviour script checked instead of the On load:

Screenshot 2023-09-14 at 18.31.40.png

Have you tried this?

Jeroen

Serena Romeo September 19, 2023

Thank you for your support Jeroen! :)

Suggest an answer

Log in or Sign up to answer