Is it possible to add a conditional custom field in create issue page

Hi All,

Is it possible to add a conditional custom field in create issue page?

If yes, how? I have just started customising jira code, your help is appreciated.

My requirement is to display a custom field in create issue page based on specific condition of the previous drop down custom field value.

Regards

Andrew Paul S

5 answers

0 vote
Pedro Cora Atlassian Team Oct 14, 2013

Andrew,

You can probably use the features of the Workflow Toolbox plugin.

Hi All,

Thanks for your reply. Can anyone help me. its urgent.

I need the source code file name corresponding to the create issue page.

Since this is the first time touching the code.. still searching to find the file name.

Your help is appreciated.

Regards

Andrew Paul S

{...}\Atlassian\JIRA\atlassian-jira\secure\views\createissue-details.jsp

in {...}\Atlassian\JIRA\atlassian-jira\WEB-INF\classes\actions.xml you search for CreateIssue

I donot have source code, you search for CreateIssue class file in your jira installation directory.

Thanks Bharadwaj for your quick response. I wanted to make sure this is the file, so cut the file createissue-details.jsp and placed in another location. Restarted the service, but still create issue page is shown.

I think there is someother file corresponds to it or do you have any suggestion.

Regards

Andrew Paul S

I think you need to restart jira.

But changing the default files might lead to Jira corruption. So I prefer to use external things like creating plugin, adding javascript.

Tell your exact requirement which I am able to look into.

i think you are trying to show or hide field on selection of select list if yes then use following script

<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_10625").change(function() {
        showHidField();
    });
       
}
 
function showHidField(){
    //drop down field selected value
    var dropDownFieldval =$.trim($("#customfield_10625 :selected").text());
    //test field1
        $("#customfield_10639").closest('div.field-group').hide();
    if(dropDownFieldval == 'Project'){
        $("#customfield_10639").closest('div.field-group').show();
    }if(dropDownFieldval == 'Release'){
        $("#customfield_10639").closest('div.field-group').show();
    }
}
 
});
 
</script>

Hi @Rambanam Prasad

I have similar requirement, i have a radio button called Test1.

When Test1 value is yes, other custom fields ( test2, test3, test4) should show.

when Test1 values is No, other custom fields should be hidden from create screen and edit screen

Can this be done with above java script, or i should create a custom plugin and put it in .js file and .xml file?

Thanks for your help.

yes, with above script you can do that, change from change event click event at line 10 and change the way of selected value for radio button at line 18 i suggest to add it as webresource module in plugin, check the link provided in @Bharadwaj answer

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

523 views 1 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you