Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Display a CustomField when a specific resolution is selected-jira server

I have writeen a code for the requirement -I would like to display CustomField only when i pick a specific resolution value.

Code:
import static com.atlassian.jira.issue.IssueFieldConstants.RESOLUTION
def resolutionField = getFieldById(RESOLUTION)
def TestField = getFieldById("customfield_30200")
if (resolutionField.getValue().toString().equals('Fixed'))
TestField.setHidden(false)
} else

{ TestField.setHidden(true) }

But it The field is not getting affected by any value change while transition .
It is always going directly to else loop not taking the selected value from resolution field .
Please have a look into it .

1 answer

0 votes
Tansu Akdeniz Community Leader Jan 12, 2022

Hi @Priti Sonar 

Try this one:

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

def resolutionField = getFieldById("resolution")
def TestField = getFieldById("customfield_30200")

def resolution = resolutionField.getValue() as Resolution

if (resolution.name.equals('Fixed')){
TestField.setHidden(false)
} else{ 
TestField.setHidden(true) 
}

There is a sample in this link

You can also temporarily use .setHelpText() to see the variable in the screen.

Ex: resolutionField.setHelpText(resolution) etc.

Hi @Tansu Akdeniz ,

Tried your code , unfortunately still the same situation .

Here fixed is the Default value of Resolution field 

TestField is visible (nevertheless which value is being selected in the resolution dropdown)

I m using behavior to fulfill this requirement  and written the code  like this :

hsm.PNG

have a look to the screenshot .

I m not sure if i m doing somewhere wrong should i need to put the code in initializer section or something else

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