how to create document automatically and change to next states by a fixed date of a month
Asked by Owen:

We need below function (comala workflow function):

1. Create one document automatically by template;

2. Auto move to next state by a fixed date of a month (example 15th each month).

Thanks!


Answers:
author: Nino Stana
body: Hello [@Owen](/t5/user/viewprofilepage/user-id/5294679) ,

In Confluence Data Center:

1. You can use [**\>Labels\<**](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650217225/Labels) to attach a workflow to a specific template. You can set a label for a workflow and then add the same label to your template. When you create a page using the template, the workflow process will automatically apply to it. You can use [**\>Sticky Labels\<**](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650217225/Labels) for more security on who can remove them.

2. By setting [**\>Expiry Dates\<**](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649890606/Expiry+Dates) to a state, you can add a [**\>Content expiry transition\<**](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650120593/State+content+transitions#Content-expiry-transition) that moves it automatically to another state once that date is reached.

I hope this helps. If you need more assistance, I'd be interested in hearing more about your use case and determining the best process.

comments: author: Owen
body: [@Nino Stana](/t5/user/viewprofilepage/user-id/4086364) Yes, Thanks!

1. Do you know how to create page by script Runner or something else (example , auto create 1 doc on 1th each month)?

2. How to change the Expiry Dates automatically by script Runner (example 15th each month)?


author: Nino Stana
body: [@Owen](/t5/user/viewprofilepage/user-id/5294679) I am not a developer, I can't help you with the technical details but I think you could achieve this by making use of APIs:

1. [**\>Atlassian Confluence Data Center Rest API\<**](https://developer.atlassian.com/server/confluence/rest/v900/intro/#about) - they seem to have an endpoint to create a page

2. [**\>Comala Document Management Rest API\<**](https://comalatech.bitbucket.io/comala-workflows/7.4.0/restapi/index.html) - We also have an endpoint for the expiry date that you could use to automate your process


author: Owen
body: [@Nino Stana](/t5/user/viewprofilepage/user-id/4086364) Thank you very much! Let me have a test.


author: Aron Gombas _Midori_
body: [@Owen](/t5/user/viewprofilepage/user-id/5294679) If you are open to alternatives, then [Better Content Archiving](https://marketplace.atlassian.com/apps/123/better-content-archiving-and-analytics-for-confluence?hosting=datacenter&tab=overview) also supports changing a page to the "Expired" status when its expiration date is passed:

![page-expiration-tracking.png](https://community.atlassian.com/t5/image/serverpage/image-id/329523i3F3079FD93C4EA10/image-size/large?v=v2&px=999 "page-expiration-tracking.png")

Note that you can specify the expiration date using plain vanilla [page labels](https://midori-global.com/products/better-content-archiving-for-confluence/data-center/documentation/page-expiration-tracking#labels)! The nicety here is that page labels can be manipulated manually and programatically with relative ease, using ScriptRunner or using the REST API.

It is something you may want to try.

*(Discl. it is a paid and supported app developed by our team. Free for 10 users!)*

comments: author: Owen
body: [@Aron Gombas _Midori_](/t5/user/viewprofilepage/user-id/502447) Good. Thank you!


Tags: confluence-data-center

confluence-server

data-center