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

Displaying a Custom Field Based on Another Field Selection - Jira 7.6.1 Edited

Hi, 

How to display a custom field based on another field selection when creating an issue in a Service Desk project. I tried following similar instructions mentioned in the link below and it did not work. I am using JIRA server version 7.6.1

https://confluence.atlassian.com/jira061/jira-administrators-faq/usage-faq/displaying-a-field-based-on-another-field-selection

I did see a few posts where people have used Behaviors plugin for these types of requirements but that does not support my Jira Version and hence i am looking if someone was able to achieve this using javascript in the custom field description.

1 answer

1 vote
Steven Behnke Community Leader Jan 02, 2018

Behaviors, part of Scriptrunner, should definitely support your version of Jira. If you have this plugin, I'd suggest using it over custom javascript.

If the script example in the KB article did not work for you, can you explain why that is? The concept in play with that article should still be sound.

Hi Steven,

I did a mistake with the custom javascript in the KB article. It works now but only with 2 custom fields. If I have to set a value to a custom field based on a System field selection (Ex. Issue Type) it does not work. Is there a way or format to read system field in the custom javascript.

Steven Behnke Community Leader Jan 10, 2018

You absolutely need to provide the script you're using as well as any errors you're seeing.

Hi Steven,

Here is the javascript i am using in the description of a custom field. This works fine when both the the fields are custom fields. But i am looking to show/hide a custom field based on a system field selection (Ex. Issue Type (id: issuetype))

 

<script type="text/javascript">
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
callChangeFunction();
});
callChangeFunction();
function callChangeFunction(){
showHidField();
// dropdown custom field change function
$("#customfield_10001").change(function() {
showHidField();
});

}

function showHidField(){
//drop down field selected value
var dropDownFieldval =$.trim($("#customfield_10001 :selected").text());
//test field1
$("#customfield_10000").closest('div.field-group').hide();
if(dropDownFieldval == 'Access'){
$("#customfield_10000").closest('div.field-group').show();
}if(dropDownFieldval == 'Fault'){
$("#customfield_10000").closest('div.field-group').show();
}
}

});

</script>

I dont see any errors but when i replace #customfield_10001 with a system field (Ex. #issuetype) it does not work. However it works for custom fields.

Steven Behnke Community Leader Jan 16, 2018

Is the intention to use this on a Jira screen or the Customer Portal.

On a Jira screen.

Hi,

I'd like to do something similar on the customer portal. I'm using Jira cloud. Any ideas how I can accomplish this? Thanks.

Steven Behnke Community Leader Jun 11, 2019

This question is a year and a half old and did not consider Cloud at all. Consider opening a new one that is more relevant. 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

How to create Jira issus from Excel file?

When to use CSV importer When managing your processes in Jira, there are many occasions where you need to create a lot of tasks. Creating them one by one will cost you a lot of time and effort and i...

4,642 views 22 33
Read article

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