• 8
    • 8
    • We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? See the corresponding suggestion.

      http://confluence.atlassian.com/display/DISC/Variables

      It would be handy to have a way to
      a) specify a set of variables (scope?)
      b) display the value of these variables
      c) use these values as input into macros.

      We can also include some system defined variables, like current user.

            [CONFSERVER-3999] Global variables

            Iain added a comment -

            Yes Please - integral to our business model

            Iain added a comment - Yes Please - integral to our business model

            Helen Setchell added a comment - - edited

            I've got somewhere by using the HTML macro and javascript (the code below display a basic list of vars available through two different methods - you'd need to extend/architect this, maybe even putting the js in an attached file on a central page with the right permissions):

            (edit: the code is going weird when I post, I've tried re-editing but check for extra curly braces and remove!)

            {{<script>}}
            {{ $(function() {}}
            {{   var params = AJS.params;}}
            {{   AJS.$.each(params, function(param,paramval) {}}
            {{     AJS.$('#params').append('<li>' + param + ':<strong>' + paramval + '</strong></li>');}}
            {{   });}}

            {{  var metatags = AJS.$('meta'); console.info(metatags);}}
                AJS.$.each(metatags, function(metakey,meta) {
                  {{if(typeof meta.attributes.name!=='undefined') {}}
                    {{AJS.$('#metatags').append('<li>' + meta.getAttribute('name') + ':<strong>' + meta.getAttribute('content') + '</strong></li>');}}
            {{      }}}
               {{});}}
            {{ });}}
            {{ </script>}}
            {{ <h2>Params</h2>}}
            {{ <ul id="params"></ul>}}
            {{ <h2>Meta tags</h2>}}
            {{ <ul id="metatags"></ul>}}

            I don't know how to create user macros, but I'm guessing you could do something similar to this at that level to make the vars exposed available to page editors.

            Another solution I found if I needed the variables before the dom was done was to use the ServiceRocket Reporting > Report Info macro (no affiliation) with the value content:id for example to get the page ID. This shows the variables you can get https://docs.servicerocket.com/reporting/suppliers

            Helen Setchell added a comment - - edited I've got somewhere by using the HTML macro and javascript (the code below display a basic list of vars available through two different methods - you'd need to extend/architect this, maybe even putting the js in an attached file on a central page with the right permissions): (edit: the code is going weird when I post, I've tried re-editing but check for extra curly braces and remove!) {{ <script> }} {{ $(function() { }} {{   var params = AJS.params; }} {{   AJS.$.each(params, function(param,paramval) { }} {{     AJS.$('#params').append('<li>' + param + ':<strong>' + paramval + '</strong></li>'); }} {{   }); }} {{   var metatags = AJS.$('meta'); console.info(metatags); }}     AJS.$.each(metatags, function(metakey,meta) {       {{if(typeof meta.attributes.name!=='undefined') { }}         {{AJS.$('#metatags').append('<li>' + meta.getAttribute('name') + ':<strong>' + meta.getAttribute('content') + '</strong></li>'); }} {{      }}}    {{}); }} {{ }); }} {{ </script> }} {{ <h2>Params</h2> }} {{ <ul id="params"></ul> }} {{ <h2>Meta tags</h2> }} {{ <ul id="metatags"></ul> }} I don't know how to create user macros, but I'm guessing you could do something similar to this at that level to make the vars exposed available to page editors. Another solution I found if I needed the variables before the dom was done was to use the ServiceRocket Reporting > Report Info macro (no affiliation) with the value content:id for example to get the page ID. This shows the variables you can get https://docs.servicerocket.com/reporting/suppliers

            Adding this feature would be greatly appreciated as it would add value to templates.

            Daniel Ziegenberg added a comment - Adding this feature would be greatly appreciated as it would add value to templates.

            Thanks for your interest in this issue.

            Unfortunately, this suggestion isn't currently on our roadmap. We do though understand the value that global variables would bring - we'll typically review this request at least once a year, at which point we’ll consider whether we need to alter its status. 

            Best,

            Jenny | Confluence Server Product Manager

            Jenny (Inactive) added a comment - Thanks for your interest in this issue. Unfortunately, this suggestion isn't currently on our roadmap. We do though understand the value that global variables would bring - we'll typically review this request at least once a year, at which point we’ll consider whether we need to alter its status.  Best, Jenny | Confluence Server Product Manager

            It'd be great to be able to display a particular Confiform record based on a querystring

            Helen Setchell added a comment - It'd be great to be able to display a particular Confiform record based on a querystring

            Sure, I'll bite, I love disappointment. +1

            David Sumlin added a comment - Sure, I'll bite, I love disappointment. +1

            +1

            Magnus Lidén added a comment - +1

            With the (commercial) projectdoc Toolbox you may define space properties (even in a hierarchical structure). These properties can be referenced by macros of the toolbox at request time. For an introduction, please refer to Using Space Properties to check if your use case can be solved with this feature.

            BTW: Properties can also be defined at page level, which is similar to the use of the Confluence Page Properties Macro. The projectdoc Toolbox calls these properties Document Properties. Compare with built-in Features is a list of short summary of the differences to the macros provided by the projectdoc Toolbox.

            For those who require to link to external resources (for reference or transclusion of content), the projectdoc Toolbox provides macros in the Information System Extension. Basically these macros use URLs defined as space properties (or other means) to generate links at request time. Examples are links to Javadoc, artifacts on a Nexus server, or diagram images from an Enterprise Architect export.

            Please note that prior to version 1.11 of the projectdoc Toolbox these macros are part of the core add-on. From version 1.11 on this feature (with some minor changes) is part of an extension (for free) and has to be installed separately.

            Biased alert: I'm one of the authors of the projectdoc Toolbox and therefore may comment may be biased ...

            Robert Reiner [smartics] added a comment - With the (commercial) projectdoc Toolbox you may define space properties (even in a hierarchical structure). These properties can be referenced by macros of the toolbox at request time. For an introduction, please refer to Using Space Properties to check if your use case can be solved with this feature. BTW: Properties can also be defined at page level, which is similar to the use of the Confluence Page Properties Macro. The projectdoc Toolbox calls these properties Document Properties . Compare with built-in Features is a list of short summary of the differences to the macros provided by the projectdoc Toolbox. For those who require to link to external resources (for reference or transclusion of content), the projectdoc Toolbox provides macros in the Information System Extension . Basically these macros use URLs defined as space properties (or other means) to generate links at request time. Examples are links to Javadoc, artifacts on a Nexus server, or diagram images from an Enterprise Architect export. Please note that prior to version 1.11 of the projectdoc Toolbox these macros are part of the core add-on. From version 1.11 on this feature (with some minor changes) is part of an extension (for free) and has to be installed separately. Biased alert : I'm one of the authors of the projectdoc Toolbox and therefore may comment may be biased ...

            Can you please let us know when this will be resolved. Than you

            Jo Sproston added a comment - Can you please let us know when this will be resolved. Than you

            Wow - I figured the past 2 hours of searching would lead me to an answer other than this. I thought for sure it was already embedded and I was too dumb to figure it out. +1...

            mrichter007 added a comment - Wow - I figured the past 2 hours of searching would lead me to an answer other than this. I thought for sure it was already embedded and I was too dumb to figure it out. +1...

              Unassigned Unassigned
              8873c89cc788 Daniel Ostermeier
              Votes:
              295 Vote for this issue
              Watchers:
              156 Start watching this issue

                Created:
                Updated: