It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Create subtask with empty fixversion

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

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

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

Probably you meant:

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

But that didn't work. Neither did this:

Long noFixVersions = null
issueInputParametersCreate.setFixVersionIds(noFixVersions)

Any other ideas @Jonny Carter [Adaptavist]?

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Off-topic

Friday Fun: Virtual dance party!

Do dance parties help you relieve stress? How about *virtual dance parties*? My team holds virtual dance parties to brighten the mood of a tough day or celebrate an upcoming weekend.  Want t...

180 views 21 9
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you