Announcement Banner Javascript

Jeanne Howe
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.
February 26, 2018

We are JIRA 7.6 datacenter/server. 

Is it still possible to add javascript to the announcement banner? I am looking to add a column to the Issues in Epic table and found the following code:

 

<script type='text/javascript'>
AJS.$(document).ready(function() {

AJS.$('#ghx-issues-in-epic-table tr').each(function(){
	console.log('Found epic table');
	var row = this;
	var issueKey = AJS.$(this).attr("data-issuekey");
	AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + issueKey, function(data){
		console.log('Got data for - ' + issueKey);
		var value = data.fields.customfield_10600;
		console.log('Value - ' + value);
		var actions = AJS.$(row).find('td.issue_actions');
		AJS.$(actions).before('<td class="nav">' + value + '</td>');
	});
});

});
</script>

 

When adding this to the Announcement Banner, the code displays as plain text in the banner. Can anyone help out a javascsript nube?? 

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 27, 2018

Yes it is possible.  however if you found this code on our site from a post that was before April 2017, it's likely that this isn't working because certain characters in that code have been converted.   This is a side-effect of our community site's migration from the old answers site.  Many of those older posts inadvertently had their contents altered in this way unfortunately.

You should be able though to correct this just by replacing all the instances of &lt; with < and all the instances of &gt; with >  

Once you do that, then the script should actually run.

Suggest an answer

Log in or Sign up to answer