Forums

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

How do do you clear a value from a custom field using scriptrunner in a post function?

Melissa McConnell November 15, 2017

I am having trouble finding a script example to clear a custom field during a post function in transition. 

Basically, I have a cfValue that will have a value in one step, but during a specific transition, I want that value to now be null. 

Any help is appreciated. 

Thanks, 

Melissa 

2 answers

0 votes
Nic Brough -Adaptavist-
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.
November 16, 2017

To clear a custom field in a script, set the value to be empty.  My notes say

customFieldX.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customFieldX), ""),changeHolder)
Nirmani Kalakheti
Community Champion
November 2, 2020

Hi @Nic Brough -Adaptavist- ,

I am getting the following errors 

unable to resolve class ModifiedValue 
 @ line 1, column 39.
   customFieldX.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customFieldX), ""),changeHolder)
                             

 @Melissa McConnell , were you able to resolve this as Nic said?

0 votes
Dave Theodore [Coyote Creek Consulting]
Community Champion
November 15, 2017

Misc Workflow Extensions has a post-function that can do this.

Melissa McConnell November 16, 2017

Thanks - I'm needing to do this without a plugin. 

Suggest an answer

Log in or Sign up to answer