I am building a Confluence Cloud App with Connect. I want to get the Page ID (Content ID) of the page, where the Macro is put on. I'm working in the View-Folder of my Connect-App in a .hbs-file.
I can get the ID by using getContext(), but I can't put it in a variable for later usage, because of the scope.
Like this I can see the ID in the console:
AP.context.getContext(function(response) {
console.log = response.confluence.content.id;
});
But what I really need would be something like this (which doesn't work):
var pageID;
AP.context.getContext(function(response) {
pageID = response.confluence.content.id;
});
console.log(pageID);
I need to somehow return the ID via the callback function? How can I do it?
Or is there a simpler way? I could only find this resource: https://developer.atlassian.com/cloud/confluence/jsapi/context/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.