How can I use macros from someone else inside my own macro

Hey there,

I want to create a simple macro, where a user has to put in a number, which is afterwards used inside another macro to do a database request.

So now my question is, how can I call a macro within my macro? Or is this even possible?

Kind regards,

Christopher Graß

3 answers

1 accepted

0 votes
Accepted answer

You can use another macro inside your user macro with this:

<ac:macro ac:name="profile">
    <ac:parameter ac:name="user">$content.getCreatorName()</ac:parameter>

Naturally you'd be using a different name and different parameter values based on what the macro your including uses.

Within your macro, construct the appropriate wiki markup or xhtml markup and render it using the appropriate renderer.

For a user macro it would be something like this when using wiki markup:


I m afraid I don't know what you exactly mean by "appropriate renderer".

Do you mean I have have to choose the correct rendering definition when I want to create a macro?

Let's say, I want to use the SQL macro, this is how I started.

## @param PfNummer:title=Nummer|type=string|required=true

select value1,value2
from test_table where pf_value3='$paramPfNummer' 

The input variable gets replaced inside the sql string, but obviously the macro does not execute the sql string.
Any idea how I can solve this problem?

Edit: I am currentyl working with Confluence version 4.3

I managed to do it by using the action.getHelper() method, rendering the whole content into xhtml.

Thanks for helping me.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,401 views 15 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you