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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Combining pageManager.getPage() and user macro parameter

Hi All

Could anyone explain what I am missing with this small user macro:

## @Param Childpage:title=Childpage ID|type=string|required=true

#set($parentpages = $pageManager.getPage($paramChildpage).getParent().getId())
$parentpages

What I try to achieve is to: 1) enter a valid pageID into the parameter "Childpage" and 2) have the user-macro return the parent page.

It works if I skip the parameter and enter a pageID directly into ...getPage(_some_pageID_). But I have no luck getting a result when using $paramChilpage - macro output is: $parentpages

I have found a couple of community-solutions working with <spacekey> and <pagetitle> that go into getPage() - but I need to find parent pages based on pageID only.

Pleased to hear.

/Anders

1 answer

1 accepted

0 votes
Answer accepted

Found the solution in an other thread... @Davin Studer had the trick: 

Convert user macro param (here: $paramuplimit) like below:

$generalUtil.convertToInteger("$paramuplimit")

Thanks for helping me out :-)

Brgds Anders

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

8,604 views 7 7
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you