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

How do I set the component field to a default value for a create (before it's entered)

DaveT August 17, 2012

I want to set the component field to a specific value for one issue type in a project (that component has no meaning to other issue types in the project, so I don't want a project-wide default). When the user selects "Create Issue" for this issue type, I want this value to show in the component/s field. i.e. a post-function won't do it. After reviewing many questions and search results I decided embedded javascript was the only option. I'm not real facile at this, but I've figured out the basics. I can check the component field for a value, and I can set the value of some other fields, like description. But how do I set the component field?

From looking at search results, I'm guessing this is a lot more complicated than something like this:
<script language="JavaScript">
if ( document.getElementById("components").value == 14730 )
document.getElementById("description").value = "I see it now";
</script>
which shows that I can access the component for a specific value and set the description. But that approach doesn't do anything to set the component.

Can someone direct me to the right stuff to set the component here? Thank you.

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
x x September 17, 2012

I think you can try to do like this:

AJS.$("#components-textarea").val("somevalue").blur();

Royce Wong
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 14, 2013

Sadly, AJS.$("#components-textarea").val("somevalue").blur(); won't work consistanly in IE8 or IE9.

0 votes
Tim Theis April 24, 2014

Did you find a solution for this?

0 votes
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.
September 17, 2012

Can't the Script Runner plugin or Behaviours plugin do this?

DaveT October 9, 2012

No, those don't set a component

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