How do do you clear a value from a custom field single select list using scriptrunner post function?

Suzanne Seaton March 14, 2018

I have a custom field single select list named 'Root Cause'. When I reopen an issue, then I want the value for 'Root Cause' to be cleared. I read through the Scriptrunner Set Issue Attributes documentation and while it provides code for text, date, user picker, system fields, checkboxes, and radio buttons I can't figure out how to do it for single select. I appreciate your help.

1 answer

1 accepted

3 votes
Answer accepted
Ivan Tovbin
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 14, 2018

Hi Suzanne,

Try something like this:

import com.atlassian.jira.component.ComponentAccessor

def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Root Cause")
issue.setCustomFieldValue(cf, null)
Suzanne Seaton March 14, 2018

Thanks so much Ivan, that worked perfectly. I really appreciate the help.

Ivan Tovbin
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 14, 2018

Glad I could help! Please mark this solution as "Accepted" if it resolved your issue.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events