Forums

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

how to clear a custom datepicker field with groovyscript

Satya Boddu November 13, 2018

Trying to write a groovy script behavior for a custom field "ETA" whenever a fix version changes (i.e retargeted)

Snippet:

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.project.version.Version
import org.apache.log4j.Level
import org.apache.log4j.Logger
import com.onresolve.jira.groovy.user.FormField

import java.sql.Timestamp;
import java.util.Date;
import java.text.SimpleDateFormat;

def log = Logger.getLogger("Bug retarget clears ETA")
log.setLevel(Level.DEBUG)


//from Satya
//def issueid = formContents["id"]
//log.debug(String.format("bbb issueid is %s", Objects.toString(issueid)))


def eta = getFieldByName("ETA")
def eta_value = eta.getValue() as Date
log.debug("**===============**")
log.debug(String.format("ETA value before: %s", eta_value))

>>>> This is not showing the ETA date of the jira ticket being updated... gives a "null"

 

And then, 

after checking if fixversion has changed.... want to make it a null string as below

eta_value.setFormValue(null)

Groovy script complains that "unknown parameter type"

Can you help solve this issue

 

 

 

1 answer

0 votes
Roland Holban (Adaptavist)
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.
November 19, 2018

Configure your behaviour on the Fix Versions field. If you do this your script will execute every time that field changes. Then in the script you can clear the ETA field.

 

Screen Shot 2018-11-19 at 11.34.47 AM.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events