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 ?
Try
clearCustomField(<customField>)
instead of setCustomfield()
This worked in my instance.
Best
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It´s my pleasuer. Great to know you got that working ;)
Best
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Trudy Claspill, thanks for your reply. Actually I'm preferring scriptrunner/scripts as they allow me to process some complex conditions easily.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.