Forums

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

Unable to clear date field using ScriptRunner Workflow Post-Function

Anurag Bharati
Contributor
July 18, 2025

In my ScriptRunner Workflow Post-Function script i'm trying to clear a date field following is the script snippet

currentIssue.update {
        if(fieldValue instanceof Date){
            setCustomFieldValue(item, null);
        }
}

 Above script return error:

ERROR - Ambiguous method overloading for method com.adaptavist.hapi.cloud.jira.issues.delegates.IssueUpdateDelegate#setCustomFieldValue.
Cannot resolve which method to invoke for [class java.lang.String, null] due to overlapping prototypes between:
	[class java.lang.String, class [Ljava.lang.Long;]
	[class java.lang.String, class [Ljava.lang.Object;]
	[class java.lang.String, class [Ljava.lang.String;]

If I try to set an empty value it gives format error.

The following errors occurred: (customfield_12237=The Target Due Date must be of the format "yyyy-MM-dd")

If I set a null Date object than it gives 

ERROR - Cannot get property 'length' on null object

Any hints how to clear a custom field of type date using the ScriptRunner Workflow Post-Function script ?

2 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
4 votes
Answer accepted
Stefan Salzl
Community Champion
July 18, 2025

Hi @Anurag Bharati 

Try 

clearCustomField(<customField>)

instead of setCustomfield()

 

This worked in my instance.

 

Best
Stefan

Anurag Bharati
Contributor
July 19, 2025

Hi @Stefan Salzl, thanks for your reply, it works :)

Like Stefan Salzl likes this
Stefan Salzl
Community Champion
July 21, 2025

It´s my pleasuer. Great to know you got that working ;)

Best
Stefan

0 votes
Trudy Claspill
Community Champion
July 18, 2025

Hello @Anurag Bharati 

Is there a reason you specifically need to do that within the script?

There is a native Clear Field Value post function you could use to clear the field.

Anurag Bharati
Contributor
July 19, 2025

Hi @Trudy Claspill, thanks for your reply. Actually I'm preferring scriptrunner/scripts as they allow me to process some complex conditions easily.  

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events