(Groovy, behavior) The system is using the method correctly, how can i make the method "known"?

chaim H December 28, 2018

import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.PRIORITY

import org.apache.log4j.Logger
import org.apache.log4j.Level

def log = Logger.getLogger("Chaimha Log")
log.setLevel(Level.DEBUG)


def startDateField = getFieldById("customfield_10906")
def priorityField = getFieldById("priority")
def issuetypeField = getFieldById("issuetype")
def endDateField = getFieldById("customfield_11097")
def startDate = {try{Date.parse("MM/dd/yyyy",startDateField.getFormValue() as String )}catch(e){null as Date}}()
def today = new Date()
def priority = priorityField.getValue()
def priorityname = priority.getName()
log.debug 'priorityname: ' + priority
def issuetype = issuetypeField.getValue()

 

 

Line 19: def priorityname = priority.getName(),

getname() shows an error of unknown method.

However, it does run correctly.

 

The system is using the method correctly how can i make the method "known"?

1 answer

1 accepted

1 vote
Answer accepted
Steven F Behnke
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.
December 28, 2018

Add 

import com.atlassian.jira.issue.IssueConstant

to the top of the script. Then change 

def priority = priorityField.getValue()

to instead read 

def priority = priorityField.getValue() as IssueConstant
chaim H December 28, 2018

Thank you, worked perfectly.

Will dig deeper to fully understand this solution.

Suggest an answer

Log in or Sign up to answer