Hide "Comment" field on transition screens

Lucas Molenaar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 24, 2012

Is it possible to hide/remove the 'Comment' field from screens used in transitions? When I open the field configuration I cannot hide it, so I hope there is a method I overlooked.

Reason is that all information I want to capture is controlled via custom fields and I find the comment box to be distracting.

6 answers

1 accepted

9 votes
Answer accepted
Svante Gustafsson Björkegren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2013

This is a simple way to suppress the comment box on a transition screen.

Add the following code in the description for one field that appears on the screen

<script type="text/javascript">
if($('#issue-workflow-transition-submit').val() =='<My Transition Name>'){
$('div.comment-input').css('display', 'none');
}
</script>

NOTE: Replace <My Transition Name> with the name(s) of your transitions.

fbeck_br December 4, 2013

Great!!! :)

Cristian _Southend_ February 5, 2014

no work in jira 6.1.6 :(

Svante Gustafsson Björkegren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 5, 2014

Hi Cristian,

You will have to replace $ with AJS.$ according to this question.

I have updated my field configuration with this and it works again!

Cristian _Southend_ February 5, 2014

I've tried both ways. And not working

the plugin works perfectly https://jamieechlin.atlassian.net/wiki/display/JBHV/JIRA+Behaviours+Plugin

Madhusudhan Matrubai May 26, 2014

I just noticed that this will not work if the field is a multi line text field, while it worked for single line text field.

Fernando Ducloux February 11, 2015

Is there any way to get this to work with jira 6.3.14? thanks!

Wei Qiao March 13, 2015

Using Behaviours Plugin will hide all the Comment field in that project. And we cannot add comment in the view issue page now. Any suggestions?

solidcode2017 September 22, 2015

Svante Gustafsson and Cristian. Thank you very much. Yes. its worked for me (v6.3.11#6341-sha1:83c4d29)

Kristin Lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 8, 2017

I am trying this script with no success, is this not supported in the Cloud version of JIRA?

4 votes
Martin Winter June 26, 2019
<script type="text/javascript">
cfid = 'customfield_12345'
workflowTransition = $('.jira-dialog').attr('id');
if ( typeof hideCommentOnTransitions !== 'undefined') {
if ( hideCommentOnTransitions.indexOf(workflowTransition) < 0 ) {
hideCommentOnTransitions.push(workflowTransition)
}
}
else {
hideCommentOnTransitions = [ workflowTransition ]
}
$( '#' + cfid ).closest( '.field-group' ).css( 'display', 'none' );
$( document ).ajaxStop(function() {
for (var i = 0; i < hideCommentOnTransitions.length; i++) {
if ( $( "#" + hideCommentOnTransitions[i] ).length ) {
$( "#" + hideCommentOnTransitions[i] ).find( '#comment' ).closest( '.field-group' ).css( 'display', 'none' );
}
}
});
</script>

We've added this snippet as the description of a new custom field `hide Comment` – the ID `customfield_12345` (variable `cfid`) has to be adjusted for every Jira instance. You can retrieve that ID by the editing- or configuration URLs for the custom field ... it is always `customfield_` with some numbers behind – and the numbers are likely to be the only URL attribute within these URLs containing numbers =)

This snippet checks on its own that the comment field is only hidden on relevant transitions – the ones, the field is present on. It stores the relevant transition IDs at first within the `hideCommentOnTransitions` array, hides itself and then the comment after every AJAX request is finished for showing up the screen.

Tim Brown July 28, 2019

Does this work on the cloud instance? All I get is the JS listed on the screen.

Thomas Deiler August 6, 2019

Hey @Martin Winter, your solution works like a charm. Tested this on Jira Software 7.13.3 with a custom field of type "numeric".

Martin Winter August 7, 2019

Hi @Tim Brown,

I've just checked your issue – and yes, the cloud version of Jira doesn't support HTML within the description. It relies on sth. like Markdown.

Probably you want to ask the Atlassian-Team for a feature to allow dedicated HTML within the Markdown?

Cheers,
Martin

Bogdan Gorka
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2020

I tested the script on 8.5.4 and it works very well. Thanks!

Martin Winter December 3, 2020

Hi everyone!

newest Jira versions do nomore support the "fix" above – that's kind of annoying ...

But since there are announcement-banners that can contain HTML, the following small addition to the announcement banner HTML can fix Jira to respect the HTML content of Field descriptions again:

<script>
    $(document).ajaxStop(function() {
        $('form.aui:not(.aui-legacy-forms) div.description').each(function() {
            if (/\&lt;.*?\&gt;/.test($(this).html())) {
                $(this).html($(this).text());
            }
        });
    });
</script>

What it does:

  • First of all do this step after every time, an AJAX call was done (Jira loves AJAX calls 😅 )
  • fetch all description elements on screens
  • check them all if they contain encrypted HTML
  • if that check gets true, push the decrypted content back to the DOM

Cheers,
Martin

Like Eduardo Santos likes this
Eduardo Santos
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 2020

Thanks for the update @Martin Winter.
It worked

ninghongju September 5, 2023

After testing, first script final working version is jira-8.6.1, don't work in  jira-8.7+.

The second script , I don't know how to use it.  T.T
update: I get it, use it in System/USER INTERFACE/Announcement Banner.
After testing, final working version is jira-8.13.27, don't work in jira-8.14+

 

That's GreatThanks very much.

2 votes
Cristian _Southend_ February 5, 2014
Jonathan Chatwin April 4, 2017

Worked for me. Thanks. 

1 vote
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 24, 2012

Well, there is a workaround. Remove the following line from /atlassian-jira/secure/views/issue/commentassignissue.jsp

&lt;jsp:include page="/includes/panels/updateissue_comment.jsp" /&gt;

Remember, this is a global change and will affect all workflows in the system.

1 vote
Tom Towkach July 24, 2012

No. We have gone round and round with this one. The only thing we came up with was creating a custom comment field that we could secure via a plugin. This was a pain in the "you know what".

If you look in JAC you'll find https://jira.atlassian.com/browse/JRA-12244 from '07. You can watch this issue and vote on it to bring it more visibilty to development.

0 votes
Joe Pitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 24, 2012

Another way is to use the jira-suite-utilities plug-in to require the other fields during the transition. then they will have to fill them in and most folks will soon learn to not put that info in the comments. Kind of like using a sledgehammer to pound in a carpet tack, but it will work.

Suggest an answer

Log in or Sign up to answer