Display contextual fields (eg Epic Name) on Edit screen when changing Issue Type (eg to Epic)

There's a known bug at JIRA on which you can vote: JRA-28105.

JIRA does not refresh the Edit screen with the fields which are available to the new context.

Example: I'm editing an issue to change its type from Story to Epic. JIRA does not show the field Epic Name which is however required. As a result this creates an unlabelled Epic wrongly. The next time someone will edit the issue to change something he/she will not be able to complete his/her action without setting an Epic Name first.

I'm trying a javascript to workaround the situation. It works fine for every field excepted for the ones in which I'm interrested; it fails for the fields only available for one issue type context such as Epic Name only for Epic.

Here's the code I added in the field configuration in the description of the field issue type.

The problem is that EpicNameElem.style.display = ''; never ends.

<script type="text/javascript">

var IssueType = { SF : 'issuetype', Epic : '19' };
var EpicName = { CF : 'customfield_11052' };

function RefreshScreen() {
  var IssueTypeElem = document.getElementById(IssueType.SF);
  if (IssueTypeElem) {
    IssueTypeElem.onchange=function() {
      if ( this.value == IssueType.Epic ) {
        var EpicNameElem = document.getElementById(EpicName.CF);
        $('#' + EpicName.CF).parent().show();
        EpicNameElem.style.display = ''; // This never ends
      }
    }
  }
}

(function($) {
  JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
    RefreshScreen();
  });
})(AJS.$);

</script>

Can someone help me?

1 answer

Is there any solution by updating the following velocity file?

<jira-application-dir>/atlassian-jira/WEB-INF/classes/templates/jira/issue/field/issuetype-edit.vm

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

439 views 7 5
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