Run variable macro - 6.x
On this page
Overview
The Run variable macro is used to access the field values provided in other macros on the same page. This macro can be used with other macros such as Wiki, Markup, Groovy, SQL for Confluence macros, and so on.
Description
Allows user defined values in the Run with a user form and parameters and Run without user form macros to be accessible to other macros on the Confluence page. The notable points for this macro are:
- Identify the form and the variable to be accessed through the macro editor.
- Access the variable value using the '$' prefix in any other macro on the same page. See Field types to learn more about the supported field types.
- If multiple Run with a user form and parameters or Run without user form macros are available on the same page, you must assign a unique ID to each macro.
- Only one variable per form can be accessed at a time.
Parameters
The following table lists the parameters available in the Run variable macro editor:
Parameter | Description |
---|---|
Form ID | Enter the form ID of either the Run with a user form and parameters or the Run without user form macro. This value must be the same as specified in Run settings > Parameters > Unique form id of the macro editor. |
Variable name | Enter the variable name as specified in the Field settings tab in the Run with a user form and parameters/Run without user form macro editor. Use this value in other macros using the '$' sign prefixed to the specified variable. |
Usage
You can add, update or delete the macro from the page.
- On the required page, type '{' to view the Macro browser.
- Type "Run" and select the Run variable macro from the list that appears, or type "Run variable" and select the macro.
Select the macro on the page to either edit or delete it from the page.
Example
This section demonstrates how to access a field defined in the Run a user form and parameters macro and display this value through a Groovy macro. For this scenario, perform the following:
- Define field value within a Run a user form and parameters macro
- Access field value defined in another macro
The query, database, field names and other values are for demonstrative purposes only. Please customize these values as per your instance.
Define field value within a Run a user form and parameters macro
First, let's populate two select list boxes using the Dynamic Select and Dynamic Multi Select field types in a Run a user form and parameters macro. To do so, the relevant profile and SQL query must be provided. See Field types for more information.
In the image:
- A Run a user form and parameters macro has defined two select lists with IDs DYNSEL01 and DYNMULSEL01. Both lists are dynamically populated using an SQL query.
The Result section shows how the variable values are displayed on the page.
Access field value defined in another macro
In the previous section, a Run a user form and parameters macro is defined with two dynamic select lists and now, the list selection is to be used in a Groovy macro that's available on the same page.
In this image:
- A Groovy macro contains two Run variable macros defined to access the form with DocTestForm01 ID, same as that of the Run a user form and parameters macro defined in the previous example.
- Variable F11 stores the value of DYNSEL01 in form ID DocTestForm01 and variable F12 stores the value of DYNMULSEL01 from the same form.
For this example, these values are simply displayed but these can be processed further as required. The Result section shows how the variable value is displayed on the page.
Result
Here, the image shows how the selected options of the lists can be accessed and displayed.
In this image:
- Rochester is selected in DYNSEL01 and 'Chicago' in DYNMULSEL01 and the form is run.
- The selections made in the first and second select lists are shown using the Groovy script.
Additional references
Log a request with our support team.
Confluence®, Jira®, Atlassian Bamboo®, Bitbucket®, Fisheye®, and Atlassian Crucible® are registered trademarks of Atlassian®
Copyright © 2005 - 2024 Appfire | All rights reserved. Appfire™, the 'Apps for makers™' slogan and Bob Swift Atlassian Apps™ are all trademarks of Appfire Technologies, LLC.