Template with variables and expand created automatically
Asked by jeremieandre:

Hi there.

I created a page template that includes "Expand" sections and "Variables".

When I create a new page and apply the template, I get to a page saying "This template uses variable. Once you fill them in, etc".

However, as soon as I expand a section to add information, it's like I'm clicking on the Create button, and I am in the editor. I cannot see the variables there, so my variable fields are pointless.

Any idea what's going on here?


Answers:
author: Scott Purcell
body: I had the same issue with variables, but I think I may have solved it. It looks like the documentation may be out of date.

I used the variable macro /variable to create the variable and expand the variable in other parts of the document. My template looks something like the following.
>
> My Page {#toc-hId--1244505875}
> ------------------------------
>
> \[my_variable \| text\]
>
> #### Other section {#toc-hId-1944071536}
>
> \[my_variable \| text\]
>
When I created the document, I got the same message about using templates in the document as describe above. I was able to input the variable. The change was reflected in both instance of the document. I clicked the Create Document button. The values were visible and in their proper places.

comments: author: Marcel Neufert
body: Hi [@Scott Purcell](/t5/user/viewprofilepage/user-id/4363013)

I understand that you have solved this issue.  
Unfortunately I do not understand how you did it.   
Can you please describe your solution?

I want to include the variables in the expanded content.

Thanks \& kind regard,

Marcel


author: Scott Purcell
body: Hi [@Marcel Neufert](/t5/user/viewprofilepage/user-id/4626226)

I'll do my best. The solution is not intuitive.

First create a template with variables and an expandable section:

![template-add-vars-and-expandable.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/171710i2915FF25BD7C3C2C/image-size/large?v=v2&px=999 "template-add-vars-and-expandable.PNG")

The variables have to be created outside of the expandable section. In the above image, I created them above the expandable section. Then I copied them into the expandable section.

After the template is saved, create a new page using the template:

![create-page-using-template.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/171712i573F7F258AE220D9/image-size/large?v=v2&px=999 "create-page-using-template.PNG")

After selecting the template, in this case **Page with parameters**, Confluence will create a page for you to input values:

![new-page-before-vars.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/171714i3A4D7C45B2EB9FFC/image-size/large?v=v2&px=999 "new-page-before-vars.PNG")

Enter the values and create the page:

![new-page-afters-vars.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/171715iA2E4F05A1524B4D2/image-size/large?v=v2&px=999 "new-page-afters-vars.PNG")

The create button is not in the image, but on my browser at the bottom of the screen. The page looks like the following.

![create-page-complete.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/171718i248E82019ECDA635/image-size/large?v=v2&px=999 "create-page-complete.PNG")

Note that the variables are no longer available after the page is created.

I hope that helps!


author: Marcel Neufert
body: Thank you very much! It is at least a workaround. Cause I do not need the variables above the expandable section.

Thanks a lot for your very detailed description!  
I reported the bug to Atlassian and they created a bug-ticket here:

<https://jira.atlassian.com/browse/CONFCLOUD-73246>

Kind regards,  
Marcel


author: Scott Purcell
body: I'm glad I could help!


author: cristov_russell
body: I'm experiencing the same issue.


Tags: cloud