ScriptRunner for Confluence Cloud macro to insert page title inline with body of page

Kristie White August 20, 2024

Hello!  I am new to Confluence Cloud and ScriptRunner.  I want a simple macro that will take the title of the Page I have created from a Template in Confluence Cloud and insert it inline with the body of the page so I don't have to retype the title again.  I have been watching videos and looking over examples.  I have attempted to write the macro, but it keeps failing.  Any help would be greatly appreciated.

I was using the real simple example for Page ID in the ScriptRunner manual and trying Title instead.

return parameters.get("title")

On my Confluence page, I get the following error:

Macro failed to return a result: Script must return a string.

Thanks in advance!

1 answer

1 accepted

1 vote
Answer accepted
marc -Collabello--Phase Locked-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 21, 2024

Hi @Kristie White ,

Not sure what the issue with ScriptRunner is.

As an alternative, we've built an addon which allows this without writing a script: Document Metadata for Confluence Cloud.  This allows you to directly add page metadata like the page title, author, last editor, last edited date etc. into the page.

Kristie White August 21, 2024

Thanks @marc -Collabello--Phase Locked- !  

I have added this add-on.  It does have everything I need.  When I go to add any of the page metadata, I can see everything correctly in the app/macro.  Unfortunately, once I add an item, I get the following error in my page.  I have opened up permissions, but I still get the error.  Not sure what I'm missing or going to the right location to open permissions.

document_metadata_error.png

marc -Collabello--Phase Locked-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 22, 2024

Hi @Kristie White ,

Thank you for reporting this.  The error is highly unusual.  Can you contact us at support@phaselockedsoftware.com such that we can help you directly?

Like Kristie White likes this
Kristie White August 22, 2024

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events