user macro resolution order

When I put a {userMacro} inside a [link to {userMacro}] it doesn t get resolved at the right time. Confluence wants to create a page, though the link exists.


1 answer

2 votes
Eddie Webb Community Champion Aug 14, 2013

I would suggest you modify the userMacro in question to just generate the link rather then the page name.

Thanks, I did just this, but isn t the resolution order violation a major bug?

Hi Guenter,

I'm not so sure this is a bug, major or minor. The output from a user macro could be anything, not just text. I guess Confluence is playing it safe and saying that a text string is expected between [ and ], hence it doesn't parse the contents for any user macro processing.



Well, thanks, my opinion is that expressions should be parsed in the right order, no matter what - and they could throw an error still if it evaluates to something the browser can t handle.

The currents behavior fits well with Confluence s other inconsistencies.

Eddie Webb Community Champion Aug 22, 2013

@Guenter - if you feel strongly, I suggest you raise a well-worded ticket here, and make your case for the Atlassian team to address. If feasible and highly desired they usually will deliver.

@Guenter - I would also be interested to know what version of Confluence you are using.

Good idea, Daniel!
5.1.3, so I need to re-test how much this applies to a version > 4. We were at 3.5.9 until recently.

Just tested this quickly and saw that a Link > Advanced [link to {userMacro}] renders an internal server error.

Needa rethink the whole dynamic link thing.

As I couldn t find a way to put a macro inside a link I had to code the whole thing as XHTML:

## @noparams
#set($len1 = $space.key.length() - 2)
#set($len2 = $space.key.length() - 1)
#set($sub0 = $space.Key.substring($len2))
#set($sub1 = $space.Key.substring($len1, $len2))
#set($sub2 = $space.Key.substring($len1, $len2))
#set($sub3 = $space.Key.substring($len2))
<ac:link> <ri:page ri:content-title="page title part 1 #if ($sub0 == "0")$sub1#else$sub2.$sub3#end page title part 2" ri:space-key="SPACEKEY"/> </ac:link>

As I got no answer to the I had to put the argument expressions into variables.


Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,196 views 13 19
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot