Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Set defualt value for summary field per issue type

uri shech April 3, 2018 edited

Hi,

 

I'm trying to write a scriot in the Summary field edt option. This script suppose to set the value of the Summary field to the word "Implement" only if the issue type is "Duv Sub-Task".

I wrote the following script (with the help of some of the discussions here):

<script type="text/javascript">
if (issue.get("issuetype").name == "Dev Sub-Task") {if (document.getElementById("summary").value == "") {
document.getElementById("summary").value = "<Implement>\n";}}
</script>

 

It's working unless i remove the issue type function and then it works for all issue types.

What do i need to change in my script so it sets only in in the issue type i want ?

 

Thanks

3 answers

1 vote
Alexey Matveev
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.
April 3, 2018

It is a bad practice to use JavaScript in your code. Better use Live Fields in Power Scripts or Behaviours in ScriptRunner plugins. You will not have such problems.

0 votes
uri shech April 3, 2018

Thanks, will do that with ScripRunner. 

 

Do you have any prepared template suggestion for my purpose?

0 votes
Tarun Sapra
Community Champion
April 3, 2018

Stay away from JS based customizations it's toxic! You can use Behaviour module in the Script runner plugin.

Suggest an answer

Log in or Sign up to answer