Hello,
I try to create a new subtask for a parent with a Scritpt but after run the code the ERROR:
Somebody know what it is :
2022-04-07 16:19:20,707 WARN [runner.AbstractScriptRunner]: Script D:\Atlassian\Application Data\Jira\XXXXXXXXXXX\SkillsAutofill.groovy failed to load/compile
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/D:/Atlassian/Application%20Data/Jira/XXXXX/JiraSupport/Connection/BigPicture.groovy: 15: unable to resolve class groovy.json.internal.LazyMap
@ line 15, column 1.
import groovy.json.internal.LazyMap
^
1 error
2022-04-07 16:19:21,660 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2022-04-07 16:19:21,660 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.IssueEvent, file: null
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/D:/Atlassian/Application%20Data/Jira/XXXXXX/JiraSupport/Connection/BigPicture.groovy: 15: unable to resolve class groovy.json.internal.LazyMap
@ line 15, column 1.
import groovy.json.internal.LazyMap
____________________________________________________________________________________________
My code is
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.config.manager.PrioritySchemeManager
// the issue key of the parent issue
final parentIssueKey = 'PROJ-13973'
// the issue type for the new issue - should be of type subtask
final issueTypeName = 'Sub-task'
// user with that user key will be the reporter of the issue
final reporterKey = 'TESTER'
// the summary of the new issue
final summary = 'Groovy Friday'
// the priority of the new issue
final priorityName = 'High'
def issueService = ComponentAccessor.issueService
def constantsManager = ComponentAccessor.constantsManager
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def prioritySchemeManager = ComponentAccessor.getComponent(PrioritySchemeManager)
def parentIssue = ComponentAccessor.issueManager.getIssueByCurrentKey(parentIssueKey)
assert parentIssue : "Could not find parent issue with key $parentIssueKey"
def subtaskIssueTypes = constantsManager.allIssueTypeObjects.findAll { it.subTask }
def subTaskIssueType = subtaskIssueTypes.findByName(issueTypeName)
assert subTaskIssueType : "Could not find subtask issue type with name $issueTypeName. Avaliable subtask issue types are ${subtaskIssueTypes*.name.join(", ")}"
// if we cannot find user with the specified key or this is null, then set as a reporter the logged in user
def reporter = ComponentAccessor.userManager.getUserByKey(reporterKey) ?: loggedInUser
// if we cannot find the priority with the given name or if this is null, then set the default priority
def priorityId = constantsManager.priorities.findByName(priorityName)?.id ?: prioritySchemeManager.getDefaultOption(parentIssue)
def issueInputParameters = issueService.newIssueInputParameters().with {
setProjectId(parentIssue.projectObject.id)
setIssueTypeId(subTaskIssueType.id)
setReporterId(reporter.username)
setSummary(summary)
setPriorityId(priorityId)
}
issueInputParameters.setOriginalAndRemainingEstimate(100,100)
issueInputParameters.addCustomFieldValue(10544, '11507' )
issueInputParameters.addCustomFieldValue(10601, '12911' )
issueInputParameters.addCustomFieldValue(10601, '12706' )
issueInputParameters.addCustomFieldValue(10229, '31/DEC/22' )
issueInputParameters.addCustomFieldValue(10235, '01/FEB/22' )
def validationResult = issueService.validateSubTaskCreate(loggedInUser, parentIssue.id, issueInputParameters)
assert validationResult.valid : validationResult.errorCollection
def issueResult = issueService.create(loggedInUser, validationResult)
assert issueResult.valid : issueResult.errorCollection
def subtask = issueResult.issue
ComponentAccessor.subTaskManager.createSubTaskIssueLink(parentIssue, subtask, loggedInUser)
The error message suggests that one of your custom fields is being provided by BigPicture and it is not able to handle the data you are trying to put into it.
Could you check if one (or more) of the five custom fields is a Big Picture field?
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.