Hi,
I'm writing a macro and I need it to save the name of the space that the macro was inserted in, can anyone help with this? is there a system variable for the space name?
Thanks,
-lee.
Hi Lee,
you get the name of the current space with: $space.getName()
could you please elaborate? when I've added this to my macro it didn't work, here's the relevant part of my code (it's inside of an HTML macro):
<script> var title; var url; var space_name;var func = function() { console.log('func loaded'); AJS.toInit(function() { console.log('toInit loaded'); AJS.$(document).ready(function() { console.log('ready loaded'); title=AJS.params.pageTitle console.log(title); space_name=$space.getName(); console.log(space_name);in the above 2 lines I'm getting the following error:What am I missing? Should I include somekind of library?..can you please guide me further on how to use the $space in my macro..?And could you guide me on where to check these kinds of stuff for further times?Thanks!!!
Ah, you didn't mention that you want to get the space name in javascript. There you get it like this:
AJS.Meta.get('space-name')
To make sure, you get the right name, try an alert first:
alert(AJS.Meta.get('space-name'));
Hey Thomas Thanks a lot!!
How did you know where to find this solution?
I've looked on google and couldn't reach any useful information...can you please explain how should I find solutions to this kind of questions in the future?...I couldn't find any good documentation for libraries that work with Atlassian or stuff like that...
-Lee
It looks like you're new here. Sign in or register to get started.