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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

289 views 3 11
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