Forums

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

Behaviour - Making a Radio Button Field Mandatory

Stephen Marsh March 14, 2019

Hi,

I am trying to make a Radio button field (Rejection Reason) un-hidden and required when the resolution 'Rejected' is chosen but it is not working. This script works when the reason field is a list but is not working for a radio button.

Can anyone advise what changes I need to make in order to have the script function with a radio button?

import com.atlassian.jira.issue.resolution.Resolution

def resolutionField = getFieldById("resolution")
def RejectionReason = getFieldByName("Rejection Reason")
def resolution = resolutionField.getValue() as Resolution


if (resolution.name == "Rejected") {
RejectionReason.setRequired(true)
RejectionReason.setHidden(false)
} else {
RejectionReason.setRequired(false)
RejectionReason.setHidden(true)
}

2 answers

1 accepted

0 votes
Answer accepted
Jean-Théo [Adaptavist]
Community Champion
March 14, 2019

Hi @Stephen Marsh ,

Are you trying to enable this in the edit screen? Because it would not work in a transition screen!

If you only want it in the edit screen, it can be done (when you edit the issue, the field will appear or not depending on the resolution value)!

Did you Add a Mapping? Because if it is not mapped to a project, it will not work.Screen Shot 2019-03-14 at 3.00.18 PM 1.png

I hope this helps, otherwise let me know and I'll try to help you further!

JT

0 votes
Stephen Marsh March 18, 2019

Hi JT,

Thank you for your reply... Apologies for the delay, I have been away for the past few days.

I was racking my brains trying to figure out why the script wasn't working but I had it mapped to the wrong project :-(

Thanks for your help :-)

Suggest an answer

Log in or Sign up to answer