Is there a way to instance documents so children pages change after editing a master document?
Asked by Tommaso Gionfriddo _Teklada_:

Each employee within the company I work for has a standardised document that contains the same set of JIRA filters different only by including the name of the employee within the filters. If I want to make a change to one of these filters I have to change it for each employee manually.

My first thought would be to create a master document who's changes will automatically propagate to child documents whilst keeping the correct employee ID in the filters. Is this possible?

If not is there any other way I could quickly and efficiently make these changes to bulk documents?

I've only recently started working with Confluence and Jira so I may be missing something obvious however nothing else comes to mind.


Answers:
author: Shannon S
body: Hi there,

Thank you for contacting us about this and welcome to Atlassian Community. It's great to have you.

In this case, I would use the [Excerpt Macro](https://confluence.atlassian.com/doc/excerpt-macro-148062.html) on the parent page. You can choose to hide the excerpted content altogether from view. You would use the [Excerpt Include Macro](https://confluence.atlassian.com/doc/excerpt-include-macro-148067.html) to display this information on the child pages. We use this a lot in our own documentation. In this case, you only need to update the main document and it'll propagate to all of the other excerpts around Confluence.

Have a look and let me know if that helps you.

Regards,

Shannon

comments: author: Tommaso Gionfriddo _Teklada_
body: Thanks Shannon,

I tested out this solution yet couldnt find a way to make the filters change for each owner of the document.

Is there a way I could add a parameter (or something of that nature) to the excerpt that would allow the filters in the document to include the name of the user?


author: Shannon S
body: Good afternoon,

The Excerpt macros don't use any filters to display content, could you let me know which filters you are referring to, and what the goal would be by using the current user? Do you just need to display the name of the user currently logged in?

In that case, you would need to write a User Macro, for example:

* [Solved: Get Current User via User Macro](https://community.atlassian.com/t5/Answers-Developer-Questions/Get-Current-User-via-User-Macro/qaq-p/485466)

This would allow you to display the name of the current user in a Confluence page.

I hope that helps, but if it's not what you require, please let me know!

Regards,

Shannon


author: Tommaso Gionfriddo _Teklada_
body: Thanks Shannon,

I'm refering to JIRA filters that display JIRA tasks assigned to users. I need the filters to refer the owner of the document, not necessarily the user viewing it.

By owner in principal this just means whoever name is at the top of the page or something to that effect.

Would I maybe be able to define a editable variable on the page which the excerpt can grab and use to display the correct filters?


author: Shannon S
body: Hello there,

Thank you for clarifying that.

Unfortunately this wouldn't be possible without some sort of [User Macro](https://confluence.atlassian.com/doc/writing-user-macros-4485.html) or add-on.

The ability to use variables has been requested in the past in a feature request, but it has been closed as we don't have plans to implement this in the neat future.

* [CONFSERVER-38067](https://jira.atlassian.com/browse/CONFSERVER-38067) *Variables in the JIRA Issues Macro*

Regards,

Shannon


author: Kirstin Seidel-Gebert
body: Hi tpgionfriddo,

like Shannon said, you could wrap the JIRA query in a Confluence user macro. You will need one user macro per query.  
This macro would get a username as a parameter and pass it to the JIRA macro.

For this to work, you cannot use saved JIRA filters but you have to specify the query on the JIRA macro within Confluence  
And you need admin access to your Confluence instance.

Cheers,  
Kirstin


author: Kirstin Seidel-Gebert
body: Hi tpgionfriddo,

by filters you mean JIRA filters, right?

If yes: in JIRA filters you can use queries like *assignee=currentUser()*. Using that in a filter will delivery different results, depending on the user who triggers the filter.

So:

1. Create the filter(s) accordingly in JIRA.
2. Refer to the JIRA filters on your Confluence page.

Would that do the trick for you?

Cheers,  
Kirstin

comments: author: Tommaso Gionfriddo _Teklada_
body: Hi Kirstin,

Yes I did mean JIRA filters, I've update the question accordingly. Thank you for noticing my error.  
Unfortunately I don't think currentUser() would fit the solution as we need to be able to have a document for each user containing the user specific filters so that User A could look at User B's document and see the filters that pertain to User B


Tags: confluence-server