Remove comments field on transition

Stefano Rosario Aruta February 11, 2019

how to remove comments field on transitionAnnotazione 2019-02-06 140200.png

this code it does not work:::::

import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutItemImpl.Builder
import com.atlassian.jira.component.ComponentAccessor
def c = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("comment");
c.setHidden(true);
//issue.getFieldById("Comment").setHidden(true);

5 answers

1 accepted

2 votes
Answer accepted
Nadine Schütt
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 11, 2019

Hello @Stefano Rosario Aruta

I had the same issue just last week and solved it with ScriptRunner Behaviours.

Was easy to configure for specific transitions only rather than the whole Jira instance and works well. 

Kevin Johnson
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 19, 2019

if you have the scripts can you please share cause i too wanna hide the comment field from a transition screen but i dont know how to do that or proper scripts to do that

Like # people like this
Nadine Schütt
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 21, 2019

Hello @Kevin Johnson 

I am afraid I cannot provide a script since my proposed solution requires the Behaviours plugin. Do you have that and struggle setting up the comments field as hidden on a transition?

Here's a quick introduction:

  1. Open Behaviours in the Jira Admin Add-ons section and click Add Behaviour.
  2. Click the Fields link on the newly created behaviour.
  3. Choose the workflow you want to hide comments on as the Guide Workflow.
  4. Add Comment as a field and click on Shown to make it hidden.
  5. Add a condition and choose the required Workflow Action you want to hide the comment on. 

I hope it works for you. 

Like # people like this
Kevin Johnson
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 21, 2019

haha i know how it works and i can clearly state a step by step procedure to do it like you did 

the problem is there is no proper way to code the scripts part thats the only issue 

can you help in that ??

jamila.augustine February 14, 2020

@Nadine Schütt : Thanks! Worked for me.

Shahriar June 12, 2021

@Nadine Schütt , that feature of ScriptRunner is not available in JIRA Cloud. Is there any other way to hide the comment field in the transition screen?

Like # people like this
1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 11, 2019

You will need a script or automation to identify which ones you want rid of and destroy them.

Stefano Rosario Aruta February 11, 2019

can you make the script?

0 votes
Przemysław Łyszkowicz April 27, 2023

Add to field that exist in screen on that transition: <script type="text/javascript">
if($('#issue-workflow-transition-submit').val() =='Transition name'){
$('div.comment-input').css('display', 'none');
}
</script>

Transition name replace with name of your transition.

0 votes
Jason Child March 17, 2019

Why not just edit the Announcement Banner (System > User Interface > Accouncement Banner) and inject some CSS styles to simply hide the comment input... simple, but effective and no custom fields need to be edited to inject javascript.

For one specific form:

<style type="text/css">
div#edit-issue-dialog div.form-body div.content div.field-group.comment-input {
display: none;
}
</style>

or... for all forms:

<style type="text/css">
div.jira-dialog div.form-body div.content div.field-group.comment-input {
display: none;
}
</style> 

 

A L November 23, 2019

it doesn't work jira core 8.4.2

Jason Child November 24, 2019

Hi A L. The above code was based on core 7.13, so they probably changed the style rules somewhat for the newer version. That said, the same technique of injecting global CSS styles via the announcement banner should still work.

You will have to use your browser development tools (firebug or chrome dev tools) to inspect the DOM and determine the appropriate selector for the comment field that you wish to hide.

Jeroen El Hahaoui March 30, 2021

Small change for Jira 8.15 (server)

<style type="text/css">
section#edit-issue-dialog div.form-body div.content div.field-group.comment-input {
display: none;
}
</style>
0 votes
Grigory Salnikov
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 11, 2019

Hi @Stefano Rosario Aruta!

Please, check the similar question and the answers below:

Remove comments on transition

Hope it helps.

Stefano Rosario Aruta February 11, 2019

-.-

Like Grigory Salnikov likes this
Grigory Salnikov
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 11, 2019

Is not what you want?

Stefano Rosario Aruta February 11, 2019

i want remove the field comment on the screen when i do a transiction

Like Grigory Salnikov likes this
Grigory Salnikov
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 11, 2019

I see. Check the similar question:

Hide "Comment" field on transition screens

Stefano Rosario Aruta February 11, 2019

it doesn't work

Suggest an answer

Log in or Sign up to answer