how to set default version for "fix version"

jane chen March 12, 2017

This question is in reference to Atlassian Documentation: Managing versions

Ask your question here...

1 answer

1 vote
Sachin Dhamale March 12, 2017

You need to write a groovy script or behaviour script to do this

jane chen March 12, 2017

Thanks for the Answer. I will try~

Nishant V March 17, 2020

Hi @Sachin Dhamale I'm kind of stuck in the similar situation. I have to set the default fix version value. I have written the below groovy script in behaviours but seems like this works only for single select field and since fix version field is multi select it is not working (or at least that's what I'm thinking). Can you please help me out on this script?

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import static com.atlassian.jira.issue.IssueFieldConstants.*

if (getActionName() != "Create Issue") {
return // not the initial action, so don't set default values
}

FormField fixVersionId = getFieldById("fixVersions")
def fixVersion = "Production - Maintenance"
fixVersionId.setFormValue(fixVersion)

Above code works if I change "fix version" field to "assignee" field like below

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import static com.atlassian.jira.issue.IssueFieldConstants.*

if (getActionName() != "Create Issue") {
return // not the initial action, so don't set default values
}

def assignee = getFieldById(ASSIGNEE)
def assigneeValue = "admin"
assignee.setFormValue(assigneeValue)

 TIA.

Nishant V March 17, 2020

Hi @Sachin Dhamale I'm kind of stuck in the similar situation. I have to set the default fix version value. I have written the below groovy script in behaviours but seems like this works only for single select field and since fix version field is multi select it is not working (or at least that's what I'm thinking). Can you please help me out on this script?

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import static com.atlassian.jira.issue.IssueFieldConstants.*

if (getActionName() != "Create Issue") {
return
}

FormField fixVersionId = getFieldById("fixVersions")
def fixVersion = "Production - Maintenance"
fixVersionId.setFormValue(fixVersion)

Above code works if I change "fix version" field to "assignee" field like below

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import static com.atlassian.jira.issue.IssueFieldConstants.*

if (getActionName() != "Create Issue") {
return
}

def assignee = getFieldById(ASSIGNEE)
def assigneeValue = "admin"
assignee.setFormValue(assigneeValue)

 TIA.

Nishant V March 17, 2020

Hi @Sachin Dhamale I'm kind of stuck in the similar situation. I have to set the default fix version value. I have written the below groovy script in behaviours but seems like this works only for single select field and since fix version field is multi select it is not working (or at least that's what I'm thinking). Can you please help me out on this script?

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import static com.atlassian.jira.issue.IssueFieldConstants.*

if (getActionName() != "Create Issue") {
return
}

FormField fixVersionId = getFieldById("fixVersions")
def fixVersion = "Production - Maintenance"
fixVersionId.setFormValue(fixVersion)

Above code works if I change "fix version" field to "assignee" field like below

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import static com.atlassian.jira.issue.IssueFieldConstants.*

if (getActionName() != "Create Issue") {
return
}

def assignee = getFieldById(ASSIGNEE)
def assigneeValue = "admin"
assignee.setFormValue(assigneeValue)

 TIA.

Prasad Andrews June 15, 2020

Hi @Nishant V ,

Need help regarding the "Fix Version/s" field 

In the issue edit screen, I want to display only "Unreleased" versions. Released Versions shouldn't be displayed in the Fix Versions field.

 

Regards,

Prasad 

Suggest an answer

Log in or Sign up to answer