Clear Custom Date Field in Post Function (Script Runner)

Jeff Abbott June 30, 2022

I am trying to clear a custom date field in a post function. The code I use works in the Console, but not in as a Post Function.

The basic code is:

def dateCf = customFieldManager.getCustomFieldObject(10900)
issue.setCustomFieldValue(dateCf, null)

Which when run as a Post Function returns an error: "Source GenericValue can not be null."  But works fine in the console as long as I define and set the issue.

Also, the dates are actually cleared out, so the script is functional even though errors are returned.

Any ideas?

1 answer

1 accepted

0 votes
Answer accepted
Andrea Pannitti
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.
June 30, 2022

Hi @Jeff Abbott,

if your postfunction is on create, you must move it after the " Creates the issue originally".

Jeff Abbott June 30, 2022

Thanks! that did the trick.

Suggest an answer

Log in or Sign up to answer