Can you update Confluence template variables after publishing?
Asked by Logan Hawkes:

I am designing a Confluence template for migration run books. I've created several template variables to be populated by the user, but there is the possibility that some of the information may change. Is it possible to change the value of a template variable post-publication?

For example:

1. The user creates a page using the template. Two of the template variables are:
   1. $newServerIP
   2. $newServerHostname
2. The user populates the variable $newServerIP with the string "10.12.12.74".
3. The user leaves the variable $newServerHostname blank.
4. The user publishes the page.
5. Subsequently, the user is informed that the newServerIP will be "10.12.12.52" and the newServerHostname will be "jira01.innitech.com".

Short of going into the database, Is there any way to change the values of the variables after publication?


Answers:
author: Rodrigo
body: Good day [@Logan Hawkes](/t5/user/viewprofilepage/user-id/5076222),

I work with apps, so my apologies if this is too far fetched :D

I have seen the app [Scaffolding Templates](https://marketplace.atlassian.com/apps/190/scaffolding-forms-templates-for-confluence?tab=overview&hosting=datacenter), which adds the possibility that when the main template is modified, all pages created with said template are also modified.

So, with this crazy idea, you could create (hopefully not too much) templates for each space/team or other classification, and when the time comes, massively update them.

But I can imagine it could be troublesome... Hope it helps as an idea, and possibly to save a few seconds :)

With friendly regards  
Rodrigo

ps. nice profile pic

comments: author: Logan Hawkes
body: That may be the only way. I was really hoping for a native solution so I keep it simple. I'm developing a Jira server migration run book template and hoped to expand it to datacenter then on-prem -\> cloud. Using templates seems to require that I have all the data at the beginning. That's not always the case. The IPs and hostnames on my current migration have already changed since my original post.


author: Rodrigo
body: I see... My apologies, as at the moment I can only think of this macro method. I'll be crossing my fingers for you to get more feedback, as its an interesting case.

Another possibility, a bit more troublesome but with native apps, would be via excerpt macros.

Perhaps creating landing pages, named after the first variable (or its combination) and using excerpt-includes could be helpful to massively update this field to the respective pages... But of course there is a lot of problematics behind it...

* [Excerpt Macro](https://confluence.atlassian.com/doc/excerpt-macro-148062.html)

Lastly, perhaps [Scriptrunner](https://marketplace.atlassian.com/apps/1215215/scriptrunner-for-confluence?tab=overview&hosting=datacenter) could help (I am no expert, I just know it has quite a deal of customizations and possibilities).

Best of luck! And if possible, please feel free to share your end solution.  
Rodrigo


author: Iman Hashemi
body: Hi [@logan](/t5/user/viewprofilepage/user-id/4987261), Iman here from ServiceRocket, vendor of the Scaffolding app which is now acquired by Appfire.

For your use-case, you can utilize Scaffolding app as mentioned by Rodrigo.

You can create a template (either space or global template) and then add your variables directly to the template inside a HTML table (native feature). Then create your pages using the Live Template macro and any changes to the template will be applied to those pages.

Alternatively, you can define the variables as Scaffolding fields (such as Text Data macro, etc). This way, the field structure is defined on the template but the values need to be provided on the page level by going to **Edit Contents** screen and entering the values. The caveat here is that, if you may need to update the field ($newServerIP) on the page level.

However if you enter the IP values directly to the template (without using Scaffolding fields), then the changes will be applied to all pages. Depending on whether you are on Confluence Cloud or Data Center, the macro names are different but the functionality of Live Template macro remains the same:

* Scaffolding Cloud: [Live Template](https://appfire.atlassian.net/wiki/spaces/SCAFC/pages/477470864/Live+Template)
* Scaffolding Data Center: [Live Template](https://appfire.atlassian.net/wiki/spaces/SCAFS/pages/477598911/Using+Live+Templates)

Hope this has been helpful and in case you need any further assistance, feel free to reach out to Appfire support team using [this link](https://appfire.atlassian.net/servicedesk/customer/portals).

Best,  
Iman


Tags: confluence-server

server