Forums

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

Can I use Behaviours FormField in my Script Listener?

Karol Szacki September 6, 2018

I would like to execute some Beahaviours field operations using my Script Listener :)

I would like to execute 'setError'.

I managed to make it work (compile?) using following imports

import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours

 

but I get null result when trying to access FormField obj

def formField = getFieldById(getFieldChanged())

or

def formField = getFieldById("customfield_10515")

then this following line won't execute correctly because of this null

formField.setError("some text")

 Any help appreciated :)

2 answers

1 accepted

1 vote
Answer accepted
Alexey Matveev
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.
September 6, 2018

Hello,

You can not execute behaviour Scriptrunner Api in a listener.

Karol Szacki September 12, 2018

I guess You and Mark (behaviours coding) are right about that.

Thank You

Alexey Matveev
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.
September 12, 2018

You are welcome!

0 votes
Cristian Rosas [Tecnofor]
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.
September 6, 2018

I don't get it... why would you need to use a behaviour function in a listener? If this is in a screen, using behaviours shouldn't be enough?

Maybe I a have a low technical knowledge to understand your question ^^

Karol Szacki September 12, 2018

To show some info on screen to the user who is performing some event dispatching  action, for example: moving issue,

It may not be possible, as Alexey stated :-/

Suggest an answer

Log in or Sign up to answer