Dynamic Announcement Banners in Atlassian Jira

We’re working with a customer to merge a large number of projects from several Atlassian Jira instances into one. To do this, we migrate a few projects at a time after business hours every other day. What this means is that users see fractured instances for some period of time. To help users understand what is happening, we wanted to give them contextual help. This meant showing an announcement banner that:

  • Gave them directions on where to find their content
  • Was specific, not just “Go to http://NewJiraInstance.com”
  • Only appeared on projects that had been migrated
  • Was easy for us to keep updated as we worked on the project

 

This was actually fairly easy to put together with some basic HTML and Javascript so we wanted to share this announcement banner drop in snippet with the community:

<!-- Example usage -->
This project's key is: <div class="dynamicProjectKey"></div>
Remember that your content has moved to: https://example.com/jira/projects/<div class="dynamicProjectKey"></div>


<script>
$(document).ready(function () { 
	let pkey = ""
	if (document.location.pathname.match("/([A-Z]+)-")[1]){
		pkey = document.location.pathname.match("/([A-Z]+)-")[1]
	}
	else if (document.location.search.match("projectKey=([A-Z]+)")[1]){
		pkey = document.location.search.match("projectKey=([A-Z]+)")[1]
	}
	else if (document.location.pathname.match("/projects/([A-Z]+)")[1]){
		pkey = document.location.pathname.match("/projects/([A-Z]+)")[1]
	}

	let targetProjects = ["ABC", "DEF", "GHI"]

	if (targetProjects.includes(pkey)){
		$(".dynamicProjectKey").each( function(index, element){ 
			$(this)[0].innerText = pkey 
		})
	}
})
</script>

This is a very simplified version of what we did, but we hope that it demonstrates just how easy it is to show dynamic content to your users

If managing complex announcement banners is an ongoing need of yours, you should check out the Announcer for Jira app (they also have a Confluence, and Bitbucket version) on the Marketplace.  A little birdie told me they may be adding project as a variable in the future. 😉


Signup for more Atlassian Jira & Confluence tips and tricks

One easy tip to avoid nuking production in Atlassian Jira and Confluence

In our previous post we discuss some automated steps you can take to help get your staging environment set up correctly. But once you’re there, new risks come up. In this blog, we focus on what you can do in both your production and staging environments to ensure your admins are less likely to confuse the two and break something.

Did you ever delete a scheme and then freak out when you realize you did it on the wrong system? When you’re heads down trying to get things done, it’s easy to lose track of which system you are on.

We’re no different, and have been guilty of this in the past. To help reduce the risk of this kind of mistake we came up with a simple visual cue to help. (more…)

Automating staging environments for Jira Part 1

We recommend customer set up staging environments for Atlassian Jira. Unfortunately, many customers decide they don’t want to build and maintain a second system. If a staging system is there, it’s rarely kept up to date. This occurs because refreshing a staging environment is a tiresome and error prone task.

Mistakes in the process can have dire consequences. The staging server could:

  • Process the inbound emails of the production one.
  • Send incorrect notifications to users
  • Mislead an admin into thinking they’re making changes in one system instead of the other