Prepopulating Summary field using javascript not working

DI2E Licensing
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.
December 24, 2014

In field configuration, in the description field for Summary I've added the following:

<script type="text/javascript">
if (AJS.$("#summary").val().length <= 0){
AJS.$("#summary").val("Issue Type");
}
</script>

When I go to create an issue that uses this field configuration, the Summary field will momentarily contain "Issue Type" but then it is wiped out and the summary field is empty.

What could be causing this?

All help appreciated.

Karla

2 answers

0 votes
Vineela Durbha September 30, 2020

@DI2E Licensing 

I am even facing same issue now. Did you find to resolve the problem?

0 votes
Norman Abramovitz
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.
December 24, 2014

Your javascript is executing too soon (ie before the page data is actually loaded.    I would try either putting this code, so it executes on jquery ready event or time delay the code execution.

If your JIRA version >= 6.2 then you might need to use the announcement banner instead.

https://confluence.atlassian.com/display/JIRA/Fields+Allowing+Custom+HTML+or+JavaScript

Suggest an answer

Log in or Sign up to answer