Forums

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

Show custom field based on Component using Scriptrunner behaviours

jamila.augustine
Contributor
March 17, 2020

Hi I am trying to create a behaviour to show a custom field based on component value.

I have read the previous helpful articles and have the following script

def comp = getFieldById(COMPONENTS)
def values = comp.getValue()*.getName()

def tatr = getFieldById('customfield_14310')

tatr.setHidden(true)

if(values.toString().contains("test"))
{
tatr.setHidden(false)

}

This shows a spread operator error on line 2 (def values) and hides the custom field  no matter what.

 

Can someone give me a hint what could be wrong?

Thanks

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
PD Sheehan
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 Champions.
October 20, 2022

This is the expected behavior.

Behaviours can't execute based on In-line edits.

Historically, in-line edits were always disabled and attempting to in-line edit would cause the full edit screen to open so that the Behaviour logic could execute as expected.

The setAllowInlineEdit was added at some point to bypass that default behavior for cases where the business wants to allow those changes despite the logic being bypassed.

If you look at this example: https://docs.adaptavist.com/sr4js/latest/features/behaviours/behaviours-examples/scripted-conditions

You can see that the inline edit is only enabled in the case of a user being an admin.

TAGS
AUG Leaders

Atlassian Community Events