Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Check radio button value with groovy

Hello

I want to check a radio button value with a groovy script.

My radio button custom fiel ID is 15002, can have 3 choose : none, oui, non.

If value is on "yes", I want a true return

 

Here the script I wrote, but don't work

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;

def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_15002")

def value = issue.getCustomFieldValue(customField);
if (value == "oui")
{
return true
}

 

Any help ?

1 answer

1 accepted

Hi @cendre Please try below code.

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
IssueManager issueManager = ComponentAccessor.issueManager
MutableIssue issue = event.issue as MutableIssue

def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_15002")


def value = issue.getCustomFieldValue(customField)

if (value == "oui")
{
return true
}

 

I try with this code, and it's work

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue

CustomField radioButton = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Configuration ?");

if(radioButton == null)
return false

if(radioButton.getValue(issue).toString().equals("oui"))
return true
else
return false

 

Thank @Subrat Mishra for your help

Suggest an answer

Log in or Sign up to answer
TAGS

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