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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Set Pages with a specific label as Options for a dropdown menu?

I would like to make a user makro that allows me to set the options of a dropdown menu as all the pages in a space with the label "inventory" (for example).

This is my code to set the options to the parents of the labels:

## @param Option:title=Label|type=string|required=true|desc=Pages that contain this label should be displayed.

#foreach ($paramOption)
#if ($ == $paramOption)
#set ($options = contentLink2($

Doesn't work however... 

Can anyone help please?

1 answer

0 votes
Bill Bailey Community Leader Nov 30, 2020

If I understand correctly, you are wanting to populate the pull-down menu in your macro to a list of labels on that page? If so, it can't be done.

What is the variable $options?

Also your Option param is a string, not an array. You would need to have the user enter a list of labels (maybe comma separated), then parse that list into an array.

No. I want to populate the list with PAGES in a space that have a specific label. ONE label that applies to a few pages. So that I can choose which of the pages should be "linked" to the current page.

$options would be the "lines" of the dropdown. The options that you can choose from.

Ideally I would like to have the user to NOT interfere with the content of the dropdown. The user should ony be able to create the page (ignore the dropdown in the process of creating the page) and when the page is created, the user should be able to choose from the preset (by me) options in the dropdown.



To give you an overview of the practical application that I imagined:

I am currently creating two template pages. One to create an entry about an employee and one to create an entry about an inventory item. In the employee-page, the user should be able to choose which inventory-page should be linked to the employee. I know this can be done by an internal link to that page, but I do not trust the users to know this sort of stuff. Thus I want to give them options to chose from.

If there are better ways than a dropdown then please give suggestions. I am relatively new to the world of Confluence.

Edit2: spelling

Maybe you can take a look at the ScriptRunner add-on and more specifically the "Choose Label macro" . 

It will enable you to make a drop down list of labels that can be selected. I use that in a template page so I know that the users can select one or more labels that will be added to the page that is created with the template. It even allows me to show readable text in the drop downs that will be translated into the corresponding label(s) in the labeling format we defined. This will prevent users from entering the wrong label.

I use the page labels to create overviews and dashboards that will show all pages using the " Content by label " macro. 

The labels for the pages are automatically set by scriptrunner's "Add Label" macro.

I want to have two templates. Template A is a description of employees and template B is a description of inventory items.

All pages A get the label "user" set and all pages B get the label "item". This is always like that.

Now I want to be able to link page/s B to a page A by setting a dropdown menu to show all pages with the label "item" in page A. The person that creates the page from my template should be able to choose from the dropdown list.

In that case, indeed, the Scriptrunner choose label macro is not usable. What you want is to have a dynamically created list in the drop down of all pages that have a certain label. These kind of dynamic real-time content is not possible with the standard Confluence system. 

It is easy to show a list of all pages with a certain label but to create a drop down showing pages with a certain label may require an add-on or make your own macro. I suggest you to either look into forms add-ons or database add-ons.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

177 views 0 6
Read article

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