Set radio button custom field is not working Edited

Hi,

I'm trying to update a radio button custom field with one of the values in this field using post-function in a specific transition.

I wrote the following groovy script:

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import static groovy.io.FileType.FILES


import org.apache.log4j.Logger
import org.apache.log4j.Category

def Category log = Category.getInstance("com.onresolve.jira.groovy.Condition")
log.setLevel(org.apache.log4j.Level.DEBUG)

def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()


def cField = customFieldManager.getCustomFieldObject('customfield_13899') //Confirm Bundle use - custom field
def cFieldValue = issue.getCustomFieldValue(cField) as String
def cField2 = customFieldManager.getCustomFieldObject('customfield_13893') //Bundle changes - custom field
def cFieldValue2 = issue.getCustomFieldValue(cField2) as String


log.info("The Bundle change current value is: "+ cFieldValue2)

if (cFieldValue=="Using Bundle as is") {
def changeHolder = new DefaultIssueChangeHolder()
cField2.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(cField2), "Bundle with no changes"),changeHolder)
//log.info("Need to write using Bundle as is")
} else if (cFieldValue=="Pulling additional algorithmic trees into an existing Bundle") {
def changeHolder = new DefaultIssueChangeHolder()
cField2.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(cField2), "Bundle change requested"),changeHolder)
//log.info("Need to write bundle change requested")
}

 

My goal is to update the radio button custom field - cField2 with a specific value depending on the value in the custom field - cFieldValue.

Do you know why the radio button custom field is not updating?

 

 

Thanks,

Bar

0 answers

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

261 views 0 12
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot