How to retrieve attachments based on labels using Run macro
This article explains how to input data using a form and retrieve attachments into a Confluence page based on attachment labels using the Run Self-Service Reports for Confluence and Advanced Table for Confluence apps.
Instructions
- In a Confluence page, insert a Run with a user form and parameters macro.
- Insert an Attachment Table macro inside the Run macro.
- Edit the Attachment macro and perform the following:
- Select the relevant filtering options for the Source, Space, and Page parameters. In this example, the Single page, Current space, and Current page options are selected for the respective parameters.
- Enter $LABEL in Attachment label regex under the Attachment filtering tab and Save the macro.
- Select the relevant filtering options for the Source, Space, and Page parameters. In this example, the Single page, Current space, and Current page options are selected for the respective parameters.
- Edit the Run with a user form and parameters macro and do as follows:
- Click Add my first field in Field settings.
- Select the desired Field Type and add LABEL in Field key.
- Click Add my first field in Field settings.
- Save the changes and publish the page.
- Enter the required label to be retrieved and click Run. Results are shown as per the given label available for the attachments on the specified page. In this example, the output is as shown:
The $ immediately followed by a Field key (in this case, LABEL) from the Run with a user form and parameters macro is replaced by the values provided in the form.