Forums

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

Simple Behaviour not working

Peter Ellis March 21, 2019

Hi,

I have tried a number of combinations to get the following simple behaviour working. It  should set the assignee if the value "CR" is  selected in the field "Defect Category". Can anyone suggest why it is not working please...

 

def selectList = getFieldByName("Defect Category")
def assignee = getFieldByName("Assignee")

def selectListValue = selectList.getValue()

if (selectListValue == "CR") {
assignee.setFormValue("vi7081")
}

 

Regards

Peter Ellis

1 answer

1 accepted

0 votes
Answer accepted
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 21, 2019

Hello @Peter Ellis 

What scriprunner version do you use?

and try

def selectList = getFieldByName("Defect Category")
def assignee = getFieldById("assignee")

def selectListValue = selectList.getValue()

if (selectListValue == "CR") {
assignee.setFormValue("vi7081")
}
Peter Ellis March 21, 2019 edited

Hi Mark,

Thanks, that worked brilliantly! The version of ScriptRunner we have is 5.4.47. Is it just a case that system fields have to be accessed with getFieldByID ?

Many thanks again.

Peter

Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 21, 2019

Yep, all system fields must be accessed by id.

You re welcome :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events