Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how to copy the radio button custom field values and add to another custom field

bhuvanv_vellireddy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 3, 2020

My Scenario: copy the values of the radio button custom field(assume 2 values in custom field) and add the 2 values to another custom field(which has 2 values in it).

 

i achieved to get the values from the radiobutton .below is the code:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.UpdateIssueRequest
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.fields.ImmutableCustomField
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.issue.customfields.option.Options;
import com.atlassian.jira.issue.context.IssueContext
import com.java.util.*;

issueManager im = ComponentAccessor.getIssueManager();

MutableIssue issue = im.getIssueObject("issue number");
ApplicationUser CurrentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();


if(issue){

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def commentManager = ComponentAccessor.getCommentManager()
def issueManager = ComponentAccessor.getIssueManager()
def cField = customFieldManager.getCustomFieldObject("radiobutton customfield")

def values = ComponentAccessor.optionsManager.getOptions(cField.getRelevantConfig(issue)).findAll {it.value.toString()}

}

output for the above code :[value1,value2]

 

Need the code to add the above values to another radiobutton custom field(which has values).

 

Please Please help.

0 answers

Suggest an answer

Log in or Sign up to answer