How to access incoming links in velocity after upgrade to 9.2.0?

Janek Schumann March 18, 2025

Dear community,

In the past, we had a user macro which showed us the incoming links to a page.
A simple code snippet can look like this (waayyy reduced):

01: #set($incLinks = $action.getIncomingLinks())
02: #foreach ($incLink in $incLinks)
03:  $inkLink.getSourceContent()
04: #end

After updating to Confluence 9.2.0 Data Center recently, this doesn't work anymore. This doesn't seem to be related to the Velocity macro security settings introduced way back. I don't see how since we are just calling a method on an POJO from Velocity.

Line 01: works

Line 02: works

Line 03: well... if we do a .getClass() on it, it returns "com.atlassian.confluence.links.OutgoingLink", as expected. However, all the methods - expect getId() and toString() - return ... nothing / null.

Since when can't we call methods from velocity on a POJO in Confluence anymore? Is there any workaround besides creating our own plugin in for this simple functionality?

toString even gives a text representation of the link like "<space key>:<page title>". It isn't that the object is empty.

To make matters weird: the "<space key>:<page title>" isn't even the one from the link. Rather it is the page itself. Why? ¯\_(ツ)_/¯


Any advice is appreciated
Janek

PS: I know there are plenty of payed plugins on the marketplace for this. But come on: no sales pitch here. This is such a simple functionality that paying for it seems like a rip off. Especially since user macro solved this for free for the last 20 years. ;-)

2 answers

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 19, 2025

The first idea that comes to my mind if those methods are disabled by the Velocity allowist? Atlassian restricts the allowed methods release by release.

0 votes
Jamie Rogers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2025

Which version did you upgrade from where this was last working? 

  • You could try engaging Atlassian support and see if you can get any help with this

Aside from the above - I don't really have an answer or other suggestion for you - its likely Atlassian removed some old/deprecated code that allowed this to work in the past since with Confluence 9 they removed a lot of legacy stuff from the codebase (at least external gadgets is being put back soon). 

Perhaps writing your own plugin for this is the way to go moving forward but I can understand the extra work / upkeep required for this might not make it worthwhile.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events