Introduction

Do you know that you can use ScriptRunner in Confluence similar like in Jira?

If the answer is no, here you are one example about it. I recommend you to install and check, this software will give you some easy ways for doing things in Confluence that, by default, are difficult without it.

This post shows you one script that creates a Macro that can show information of the page, inside the page.

Yes, you read correct…you can create Macros without knowing a lot of information about JavaScript, html or Php! only…if you know how to use Scriptrunner for Jira, your knowledge guides you for achieve the same in Confluence!

 

In my opinion, the most important of this code is the part of

def entity = context.getEntity()

this is giving you the “page” as the same as in Jira is “the issue”. With this you can do a lot of things.

Steps

  1. Go to Macros of ScriptRunner
  2. Create Macro

Link of the code:

https://github.com/MrAddon/Blog_Examples/blob/master/ConfluenceScript.groovy

3. Insert the new Macro in one page

4. Results

If everything is ok, inside Macros of ScriptRunner you will see something like:

And in your page the following code:

I hope it helps.

 

Posted by:juanjomarchal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s