Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,458,138
Community Members
 
Community Events
176
Community Groups

Convert PocketQuery template to cloud

Edited

We've just migrated our on premise Confluence server content to the cloud version, and our PocketQuery templates don't work anymore.

We were taking the results of a query which produces a list of Topics. These Topics refer to pages in the current Space (by title). We need to be able to create a table of links to the pages referred to by each Topic in the result set.

In our on premise server version I used $pageManager.getPage() to find the relevant page, but this seems to be deprecated. I tried converting it to using $contentService, but something is obviously wrong, because the page comes up saying there is a template exception. However, I can't seem to find where this exception is, so I don't even know what is going wrong.

Can someone tell me:

  1. How to do what we did originally with $pageManager?
  2. How to see the exception produced by the template?
  3. Where I can find more information about how to do these templates?

Thanks in advance.

 

For completeness, what we used to do in the server version was:

#foreach ($row in $result)
<tr>
<td class="confluenceTd">
#if ($$pageManager.getPage($page.spaceKey, $row.name)) ## page already exists
<a href="$row.name">$row.name</a>
#else ## page doesn't exist yet
<a class="createlink" href="${req.contextPath}/pages/createpage-entervariables.action?templateId=5308417&spaceKey=$page.spaceKey&title=${generalUtil.urlEncode($row.name)}&linkCreation=true&fromPageId=$page.id">$row.name</a>
#end
<td class="confluenceTd">
$row.experts
</td>
</tr>
#end

What I've tried in the cloud version is:

#foreach ($row in $result)
<tr style="border-bottom-width: 2px">
<td>
#set($pageFound = $contentService.find(new Expansion('version'), new Expansion('id')).withType(ContentType.PAGE).withSpace($page.spaceKey).withTitle($row.name).fetch().get())
#if ($pageFound) ## page already exists
<a href="$row.name">$pageFound</a>
#else ## page doesn't exist yet
<a class="createlink"
href="${req.contextPath}/pages/createpage-entervariables.action?templateId=6425065&spaceKey=$page.spaceKey&title=${generalUtil.urlEncode($row.name)}&linkCreation=true&fromPageId=$page.id">
$row.name</a>
#end
<td>
$row.experts
</td>
</tr>
#end

and with debug switched on, I get the error:

12:35:12.770 ERROR An error occurred during Template rendering: The Template renderer stopped because of an ExecutionException. 

 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS

Atlassian Community Events