Good afternoon all,
i want to use the "decisions" feature in combination with the decision log in a project. To use it, it is necesarry to have an automatic ID, which is given with each creation of a decision. I am using Confluence Server V. 8.9.8.
To create such ID i wrote a confluence user macro, but it doenst work so far (it just shows the last two lines of code in plain text) and to be honest being a first timer with macros, velocity is a bit confusing. I guess i got something wrong with the syntax.... Could someone check the code or give other advice to solve my issue with a macro?
I already changed the blueprint of the decision feature, so i hope by getting the code straight, it shall work quickly.
Here is the code:
#** ======== AUTOMATIC DECISION ID ASIGNMENT
This Confluence user macro creates an ID for decisions and increments it with each new decision creation.
Version: 1.0.0 Updated: 13.12.2024
Author/s: Johannes Klever
Macro Body Processing: No macro body
*# #** ---------------------------------- PARAMETER #*
## @Param prefix:title=Prefix|type=string|required=false|desc=Add a prefix to the ID
#** ----------------------------------------------------- OUTPUT #*
#set($increment = $action.getPersistentProperties().get("decision-id-counter")) #if(!$increment)
#set($increment = 1)
#else #set($increment = $increment + 1)
#end
$action.getPersistentProperties().put("decision-id-counter", $increment) $paramPrefix$increment
I'm not sure you will obtain what you want with User Macros.
A User macro will generate his content each time it is called in the page.
As there is no decision macro on DC, are you intending to implement something equivalent with page properties ?
Regards,
Hi Cyrille,
im sorry i cant share screenshots due to sensitive data, but in the version 8.9.8, the decision and the decision log are features and can be taken from the templates directly. I just adapted the decision template so there is an other row "ID" in the decision itself and the decision log. See the screenshot from google to get a better understanding.
Now i just want a "global" variable to be incremented when hitting the create decision button.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok,
Then from what I see on this page this model is using the macro page properties.
In the screenshot, table displayed is composed by the page title (Decision), and the properties (Status, Stackholder, Outcome, Due Date, Owner)
Each time you are clicking on the button "Create Decision", you are using the macro Create from Template calling the template Decision.
I don't get why you need to play with the ID. Do you want to increment this number to prefix the page title by this number ? Or something else ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I need an additonal row in the decision log, displaying an ID which consits of a counter starting with one. I work on a field of business where traceability in requirements engineering is quite important. A title is not a suitable ID so i need a number/counter.
My Approach was: adapt the blueprint for the decision macro so that when creating a decision i have a new field "ID" in the table (See screenshot, sorry its in german, it says Status, Stakeholders, Result, Due Date, Owner and ID). For sure, the displayed properties in the decision log are also adapted, so there is a new column displaying the id.
But atm i need to type in the ID manually when creating a decision. I just want a Ma macro which checks for a global variable and than increments it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.