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-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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