Example: Return the Page ID

You can create a macro to pull the Page ID of Confluence content onto a Confluence page.

Create the macro

  1. Select the Settings cog in the top right-hand corner of the screen. 
  2. Select Macros under ScriptRunner
  3. Select Create Custom Macro
  4. Enter a Name to identify the Macro, like Page ID
  5. Enter an optional Description, like Gets the page ID
  6. Select Enabled to allow the macro to be added to pages. 
  7. Select None for Body Type. 
  8. Pick Block for Output Type. 
  9. Enter the following script into the Script to Execute field: 

    groovy
    return parameters.get("pageId")
  10. Select Save.

The macro appears on the main Macros page.

Additionally, users in your instance can add it to Confluence pages. When it's added and the page is published, it appears like this:




On this page