Hi Guys,
I'm new to ScriptRunner and want to check out the product. However, when I try to activate scripted field examples, I have a few problems.
The first comes from static type checking:

What I understand from this message is that the fourth argument is not declared or something like that but issue is defined just below. For the moment I can't find the solution, there are a lot of docs on the server and the docs on the Cloud don't help me or I've missed something (it's very likely).
The second, perhaps related to the first, is that I can't activate the field (I can't save it).
Could someone tell me what I've done wrong?
Thank you very much and have a nice day.
// Fetch the issue object from the key using the Jira Software API
def issue = get("/rest/agile/1.0/issue/${issue.key}")
.header('Content-Type', 'application/json')
.asObject(Map)
.body
// Check if the issue is in a sprint and if so if the sprint is an active sprint
if (issue.fields.sprint && issue.fields.sprint.state == 'active') {
// Get the sprint start and end date strings from the API
String sprintStartDate = issue.fields.sprint.startDate
String sprintEndDate = issue.fields.sprint.endDate
// Format the date strings into a nicer format
String formattedSprintStartDate = sprintStartDate.substring(0, 10)
String formatterSprintEndDate = sprintEndDate.substring(0, 10)
// Set the dates in the scripted field
return "Sprint Start Date: ${formattedSprintStartDate} Sprint End Date: ${formatterSprintEndDate}"
// Return a default message if the issue is not in active sprint
} else {
return "The ${issue.key} issue is not currently in an active sprint"
}