How to hide a particular issue Type for particular project using javascript

Ramesh Udari1 January 5, 2012

Hi,

We want to hide a perticular issue type from create isuue screen for a particular project using javascript and this issue type is bieng used in other project also and we need this issue type as well in this project for searching old issues by using issue navigatior that means issuetype shoould be present in issue navigetor and not in create screen.

8 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
MatthewC
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.
January 30, 2013

Not exactly what you want but another approach is to use workflow permissions....

We recently "retired" an issue type from a project but couldn't remove it because they wanted to hold the old (closed) issues for their history.

So for the issue types which were now retired, we modified the workflow so that the "Create" transition, which is fired before an issue is created, had a security permission on it. e.g. project administration right

So anyone who didn't have this permission, could not create an issue but it was still available in the search screens as a valid issue type to search on.

MatthewC
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.
January 30, 2013

p.s. no plugins, no modify source files....

Kim Weathersby January 23, 2018

Thank you for this very helpful information!

2 votes
Alexandru_Iacob
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.
January 19, 2014

Hello,

For those still interested in a solution for this, you should also take a look at the Live Fields feature of the JJupin plugin and the lfRestrictSelectOptions routine.

You just have to configure a SIL script and associate it with the desired project, as described here: http://confluence.kepler-rominfo.com/display/JJUPIN/Live+Fields+Configuration.

You can specify on which screen to execute the script by using the "screen" argument: http://confluence.kepler-rominfo.com/display/JJUPIN/Accessing+the+current+screen.

The SIL script for restricting issue type "Improvement" for example, on the create issue screen, would look like this:

if(argv["screen"] == "create") {

lfRestrictSelectOptions("issueType", "Improvement");

}

Hope this helps.

Eric Sebian November 8, 2018

Did you actually get this to work??

1 vote
MattS
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.
January 12, 2012

You could also leave it in the select list but use a validator on the workflow create transition to reject creation of new issues with that issue type.

~Matt

0 votes
artafon January 19, 2014

Niyas, Hi !

I have changed the requirements, so the above solution recorded in Notepad :)
0 votes
artafon March 4, 2013

Thanks all for the answers! I resolved problem.

Niyas January 16, 2014

Hi artashes,

Could you please explain how did you resolve this issue.

I also need the same requirement. Still i cant find any solution.

Thanks,

Niyas

0 votes
artafon January 30, 2013

Hi. You mean leave in permission scheme - browse project, and create issue - denied, right? But that not what i want. I want when user click on button Create, in create screen in field issue type was particular issue type. For example, if available 2 issue type for user then in my case i want that available 1 issue type in create screen.

MatthewC
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.
January 31, 2013

Cheers, Jozef..

@Artashes... if you just take it off the create screen, it's still possible to create the issue type if you have the REST API active. Just because you take something off the screem doesn't make it impossible. if you work the rules into the workflow/permission scheme, then it's secure.

Jozef Kotlár
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.
January 31, 2013

No you need to create workflow scheme for given project with specific workflow attached to your retired issue type.

0 votes
artafon January 30, 2013

Matt, Hi, what plugin do you mean?

0 votes
Daisy Zhang January 5, 2012

Hello Tom, you can workaround this by adding a script at the end of createissue-start.jsp file.

<script language="JavaScript" type="text/javascript">
<!--
remSelOpt(document.getElementById('issuetype114011'),document.getElementById('issuetype'));

function remSelOpt(inp1, sel1)  
{  
 len1 = sel1.options.length;  
 for (i=0;i<len1 ;i++ )  
 {  
  if (sel1.options[i].value == inp1.value)  
  {  
   sel1.options[i] = null;  
  
    //or  
  
  //sel1.remove(i);  
    break;  
  }  
 }  
  
}  
-->
</script>

Deepali Bagul February 24, 2017

This doesn't work for JIRA 7.2.3 sad

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events