Forums

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

Change Radio Button Based on Transition with Modifier

Renee Olson October 15, 2020

Is there a way to modify this recommendation that explains how to set up the transition to change a radio button?

https://community.atlassian.com/t5/Jira-Software-questions/Change-Radio-Button-Value-on-transition/qaq-p/1337118

 

I would like it to change only if the radio button is in a specific selection.

 

If None, do nothing

If Yes, do nothing.

If No, change to yes.

Currently, it changes regardless of the original setting.  I'm looking to add a modifier to change ONLY if no is selected.

Thanks!

1 answer

1 accepted

0 votes
Answer accepted
John Funk
Community Champion
October 15, 2020

Hi Renee,

You are probably going to need an add-on like JMWE or ScriptRunner to be able to do that. I know you can with JMWE as we use that. 

Renee Olson October 15, 2020

I have JMWE. Is there a page you can reference that can show me how to do that?

John Funk
Community Champion
October 15, 2020

You should be able to just add a Condition to the Post Function that updates radio button. Do you already have a post function that updates the radio button?

screenshot.png

Renee Olson October 15, 2020

I do. I can't figure out what to put in the conditional area to make it change only when no is selected.  My fields are the system field None, Yes and No.

 

If None or Yes I want it to do nothing. If No is selected, I want it to change to yes.

John Funk
Community Champion
October 15, 2020

Use the Issue Fields dropdown list provided in the Condition section.

Search for your radio button field and select it

It will show you several examples of code to use.

Under Testing the field's value, you probably want to use what's in the first example. Something like:

issue.fields.customfield_17003.value == "A value"

Click on the example and it will automatically insert the code for you. Then change "A value" to "No"

issue.fields.customfield_17003.value == "No"

Be sure to test it with a couple of issues that currently have the values. You should see True for those with No and False for Yes or None issues. 

Like Renee Olson likes this
Renee Olson October 15, 2020

Thanks so much for the tip - this is the final code

 

issue.get("customfield_17600") == "No"

Like John Funk likes this
John Funk
Community Champion
October 15, 2020

Glad it worked out for you. I have been seeing the code switch recently to be more inline with what you posted. The folks at JMWE are super to help as well. 

Like Renee Olson likes this
David Fischer
Community Champion
October 15, 2020

Thanks John for helping out Renee - and for the nice comment about us at Innovalog :)

Just for future reference: 

issue.fields.customfield_17003.value == "No"

would be on Jira Cloud, not Server/DC.

David

John Funk
Community Champion
October 16, 2020

Ah, that explains it! Thanks for the clarification and support as always @David Fischer !!!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events