Create subtask with empty fixversion

Viktor Kuzmychov February 27, 2017

Hi there,

I got an issue: I can't create a subtask with empty fixversion list, it always inherits it from parent issue. My code looks like this:

IssueInputParameters issueInputParametersCreate = ComponentAccessor.issueService.newIssueInputParameters()
issueInputParametersCreate.setSkipScreenCheck(true)

//System fields
issueInputParametersCreate.addCustomFieldValue(taskIDCustomField.id, planIssue.id.toString())
issueInputParametersCreate.setIssueTypeId(ComponentAccessor.issueTypeSchemeManager.getSubTaskIssueTypesForProject(taskIssue.projectObject).find{it.name=="SubTask"}.id)
issueInputParametersCreate.setProjectId(taskIssue.projectId)
issueInputParametersCreate.setSummary(devSummary.concat(taskIssue.summary))
issueInputParametersCreate.setReporterId(taskIssue.reporterId)
issueInputParametersCreate.setSecurityLevelId(taskIssue.securityLevelId)
issueInputParametersCreate.setComponentIds(component)
issueInputParametersCreate.setFixVersionIds()
IssueService.CreateValidationResult createValidationResult
createValidationResult = ComponentAccessor.issueService.validateSubTaskCreate(loggedInApplicationUser, taskIssue.id, issueInputParametersCreate)
if (createValidationResult.isValid()) {
    IssueService.IssueResult createResult = ComponentAccessor.issueService.create(loggedInApplicationUser, createValidationResult)
    if (createResult.isValid()) {
	    ComponentAccessor.subTaskManager.createSubTaskIssueLink(taskIssue, createResult.issue, loggedInApplicationUser.directoryUser)
	}
}

So after I've created a SubTask, I have to clear fixversion like this:

IssueInputParameters issueInputParameters = ComponentAccessor.issueService.newIssueInputParameters()
issueInputParameters.setSkipScreenCheck(true)
issueInputParameters.setFixVersionIds()
UpdateIssue(newIssue, automationUser, issueInputParameters, logPref)

But in this way I have a record in history of a SubTask about FixVersions. Is there any way to keep it empty while creation? 

 

My ScriptRunner version is 3.1.3

JIRA is 6.4.7

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Jonny Carter
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.
February 28, 2017

Can you try passing an empty Long[] to the setFixVersionIds() method?

//...
Long[] noFixVersions = []
issueInputParametersCreate.setFixVersionIds()
//...
Viktor Kuzmychov March 2, 2017

Probably you meant:

Long[] noFixVersions = []
issueInputParametersCreate.setFixVersionIds(noFixVersions)

But that didn't work. Neither did this:

Long noFixVersions = null
issueInputParametersCreate.setFixVersionIds(noFixVersions)
Viktor Kuzmychov March 3, 2017

Any other ideas @Jonny Carter [Adaptavist]?

0 votes
Viktor Kuzmychov March 8, 2017

Hi @Jamie Echlin [Adaptavist], could you please take a look here? Do you have any ideas? 

TAGS
AUG Leaders

Atlassian Community Events