Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bulk Creation Of Pages From A Template

Dave Keating August 19, 2020

Hi there! This has been asked a few different ways but I can't find a specific example of what I'm trying to achieve.

I'm looking to manage a HR process within Confluence pages (all contained within a single space).

To do this, I need to create ~220 individual pages (from a Template) with employee names added into the titles.

As part of this, I need to manage permissions on the page, only granting access to the employee, manager and exec for each business line.

The outcome would be a page for each employee in this process, with restricted access to the three relevant people (those people would be different for each page created).

I'm looking for a way to automate this process, rather than manually creating all the pages. Does anyone know of a solution for this?

Thank you for any help you can give me!

3 answers

2 votes
Roland Holban (Adaptavist)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2020

Hello @Dave Keating. You could accomplish what you want using ScriptRunner for Confluence. It should be possible to fully automate this.

You would need to write an inital custom script which you would run in ScriptRunner's Script Console. This will take care of your current users and create pages for them.

Then after, if you want to automate future creation of pages, you could write an Event Listener that would get triggered every time a new user is created and create a page for them.

Jonny Carter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2020

To say a bit more, we have an example in our documentation on how to create a page whenever a new user is created:

https://scriptrunner.adaptavist.com/latest/confluence/listeners.html#_create_page_when_user_created

You could adapt that script to perform the "loop through all existing users and create a page" script that Roland mentioned, above. We have an example of another script that loops through all Confluence users to deactivate inactive ones, which may be helpful. https://library.adaptavist.com/entity/deactivate-inactive-users-in-confluence

Like 2 people like this
Dave Keating August 31, 2020

Thank you for this answer! I'm waiting to onboard all users to I can create the page and set the permissions in one hit. Will reply back with process and results once I have done it. Thank you again!

0 votes
Michael Kuhl {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2020

Hi @Dave Keating as @Ste Wright  mentioned you can use the Bob Swift Confluence Command Line Interface to do this without scripting.

Briefly - assuming you have the list of employees in a CSV file named "employees.csv"  with employee, manager and exec columns for each business line and the template page is somewhere on the same Confluence instance you can do something like this:

Create pages from template:

Using runFromCsv | copyPage

acli --action runFromCSV --file "employees.csv" --common "--action copyPage --space \"TEMPLATE\" --title \"Template Page\" --newSpace \"HR\" --replaceTitle \"@employee@\" "

Set page permissions for employee:

Using runFromCsv | addPermissions 

acli --action runFromCSV --file "employees.csv" --common "--action addPermissions --space \"HR\" --title \"@employee\" --permissions \"View\" --userId \"@employee@\" "
Dave Keating August 31, 2020

Thank you for this answer! Really helpful.

0 votes
Ste Wright
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 20, 2020

Hi @Dave Keating 

I don't know a native way of doing this - you might need to consider an app which can help you drive some automation around page creation & restrictions.

For example, you could look into:

All of these have some levels of automation related to the areas you mentioned! Or you could check-out what else is on offer on the Marketplace :)

Ste

Dave Keating August 31, 2020

Thank you for this response, it was really helpful.

Like Ste Wright likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Upcoming Confluence Events