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

Viktor Kuzmychov Feb 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

1 vote
Jonny Carter Feb 28, 2017

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

//...
Long[] noFixVersions = []
issueInputParametersCreate.setFixVersionIds()
//...
Viktor Kuzmychov Mar 02, 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 Mar 03, 2017

Any other ideas @Jonny Carter [Adaptavist]?

0 votes
Viktor Kuzmychov Mar 08, 2017

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Off-topic

Disney Live Action Reboots: Are you for or against?

Happy Friday Everyone! Today marks the international release of Disney's live action version of the animated classic Aladdin. I know that this movie was met with some controversy of over cast...

139 views 19 8
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