Forums

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

How to clear the options of customfield on transition screen using behavior groovy script.

Sambit Choudhury February 7, 2022

How to clear the options of customfield on transition screen using behavior groovy script.

1 answer

1 accepted

0 votes
Answer accepted
Tim Perrault
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.
February 8, 2022

Hi @Sambit Choudhury 

 

I would actually use a postfunction to do this. Specifically the Clear field(s) [ScriptRunner] postfunction.

 

Thanks,

Tim

Sambit Choudhury February 9, 2022

But I am trying to achieve this in "Edit Issue screen", for this I am not able to set post functions.

Tim Perrault
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.
February 9, 2022

Well you could use a behaviour and this basic code will clear the field, but i'm guessing you will need to add more to it so that it only fires when you need. Just put in your field name.

 

def field = getFieldByName('Your Field Name')
field.setFormValue('')
Sambit Choudhury February 9, 2022

It's not working for dropdown single select field, but this method working for text fields.

Tim Perrault
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.
February 9, 2022
def field = getFieldByName('Your Field Name')
field.setFormValue(-1)
Like Sambit Choudhury likes this
Sambit Choudhury February 11, 2022

Thank you this worked for me.

Suggest an answer

Log in or Sign up to answer