I need to display on a page the key of the workspace the page belongs to. When moving the page to another workspace, it should automatically display the key of that new workspace.
In a Confiforms environment I would use [entry._page.spaceKey], but I want to avoid using confiforms just for this.
How can I achieve this without using Confiforms?
Have you considered creating a simple user macro to do that?
$content.spaceKey
contains this... https://confluence.atlassian.com/doc/user-macro-template-syntax-223906130.html
Hi Alex,
you seem to be active everywhere ;-), we just discussed about confiforms...
No, I didn't consider a user macro; I don't have access to user macros as I'm not a site admin.
I hoped there is a solution that can be implemented directly on pages. Our IT department is a bit reluctant on supporting user macros.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have HTML macro enabled in your Confluence instance?
AJS.params.spaceKey
contains this info....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, got it. that works!
Thanks.
Sample code, where Key is displayed when a button is pressed - if anyone else is having the same issue and is not so familiar with scripting of html pages...
<script type="text/javascript">
function showMessage(msg) {
AJS.$('#spaceKey').html('Workspace key is: <strong>'+msg+'</strong>');
}
</script>
<button class="aui-button submit" type="button" onclick="showMessage(AJS.params.spaceKey)">Show Key</button>
<br />
<div id="spaceKey"></div>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.