Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to set a default component for certain issue types?

Sander Kleykens September 30, 2014

Is there a way to set the default component for a specific issue type in a project?
As far as I can find on Google this is not possible in standard JIRA?

The only way I can see is inserting JavaScript into the create issue screen, for example using the description of the Component/s field. However, there doesn't seem to be an easy way to programmatically change the autocomplete value and have it update its view?

I can update the internally used value using the following:

AJS.$('#components').val(["14371"]).trigger("change");

Where 14371 is the component ID and the value in the option tag for the component. But this call does not update the component selector's view. Updating the view myself seems even more hacky and dangerous when thinking about breakage in future updates.

Does anyone know of a way to update both the value of the selector and its view?

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Joffrey_Hamman March 31, 2017

Little tricky, but you will need to use the both line together, the first will truly select the components, the second will display it to user:

AJS.$("#components").val(11902); //11902 is id of "My Component"
AJS.$("#components-textarea").val("My Component").blur();
0 votes
Simon Kegel //SEIBERT/MEDIA
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 1, 2014

Yes there is no default for that - except for JIRA service desk. There you can set a component value in the screen for service desk.

You could edit the workflow to set the component to some value while the create process.
Not the most elegant solution but this works - but you have to set another workflow for each issuetype.

A better solution would be a conditional post function setting this value based on the issuetype.
With Misc Workflow Extensions or ScriptRunner this is possible.

Hope this could help.
Greets
Simon

 

TAGS
AUG Leaders

Atlassian Community Events