I'm attempting to do some calculation on the fly to set an SLO date based on the date of the transition plus a custom number field value. I think I'm close, but can't figure out what I need to improve.
Here is my console code I'm using to test:
def thisissue = Issues.getByKey("CLECOPS-7")
def dateplus = thisissue.getCustomFieldValue("Commitment SLO")as int
def today = new Date()
def slodateplus = today + dateplus
setCustomFieldValue("Vendor Processing SLO Date",new Date(slodateplus.getTime()))
And here is the result:
org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: Script_ca4bec07532a334a4674acf9a9009729.setCustomFieldValue() is applicable for argument types: (String, Date) values: [Vendor Processing SLO Date, Wed Apr 09 17:10:23 UTC 2025] at ConsoleScriptExecution1_groovyProxy.run(Unknown Source) Caused by: groovy.lang.MissingMethodException: No signature of method: Script_ca4bec07532a334a4674acf9a9009729.setCustomFieldValue() is applicable for argument types: (String, Date) values: [Vendor Processing SLO Date, Wed Apr 09 17:10:23 UTC 2025] at Script_ca4bec07532a334a4674acf9a9009729.run(Script_ca4bec07532a334a4674acf9a9009729.groovy:6) at com.adaptavist.sr.cloud.workflow.AbstractScript.evaluate(AbstractScript.groovy:27) at com.adaptavist.sr.cloud.events.ScriptExecution.run(ScriptExecution.groovy:41) at ConsoleScriptExecution1_groovyProxy.run(Unknown Source) at com.adaptavist.sr.cloud.MainHandler.executeScript(MainHandler.groovy:416) at com.adaptavist.sr.cloud.MainHandler.processInput(MainHandler.groovy:365) at com.adaptavist.sr.cloud.MainHandler.access$1(MainHandler.groovy) at com.adaptavist.sr.cloud.MainHandler$_handleRequest_closure2.doCall(MainHandler.groovy:173) at com.adaptavist.sr.cloud.MainHandler$_handleRequest_closure2.call(MainHandler.groovy)
I'm assuming that my issue is that my custom date field is for the date only and not the time, and that the function I'm using is giving date and time, which is causing the script to error.